// JavaScript Document

<!--
if (self != top) { // we are in a frame!
   top.location.href=window.location.href; // kick it!
}
  
function MM_timelinePlay(tmLnName, myID) { //v1.2
   //Copyright 1997 Macromedia, Inc. All rights reserved.
   var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
   if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
   tmLn = document.MM_Time[tmLnName];
   if (myID == null) { 
      myID = ++tmLn.ID; firstTime=true;
   }//if new call, incr ID
   if (myID == tmLn.ID) { //if Im newest
      setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
      fNew = ++tmLn.curFrame;
      for (i=0; i<tmLn.length; i++) {
         sprite = tmLn[i];
         if (sprite.charAt(0) == 's') {
            if (sprite.obj) {
               numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
               if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
                  keyFrm=1;
                  for (j=0; j<sprite.values.length; j++) {
                     props = sprite.values[j];
                     if (numKeyFr != props.length) {
                        if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                        else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
                     } else {
                        while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                        if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                           if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                           else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
                        } 
                     }
                  }
               }
            }
         } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
         if (fNew > tmLn.lastFrame) tmLn.ID = 0;
      }
   }
}


/* Functions that swaps images. */
function MM_swapImage() { //v3.0
   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
      if ((x=MM_findObj(a[i]))!=null){
         document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
      }
}
function MM_swapImgRestore() { //v3.0
   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
   var d=document; if(d.images){
      if(!d.MM_p) d.MM_p=new Array();
      var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
         if (a[i].indexOf("#")!=0){
            d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
         }
   }
}
function MM_timelineGoto(tmLnName, fNew, numGotos) { //v2.0
   //Copyright 1997 Macromedia, Inc. All rights reserved.
   var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,lastKeyFr,propNum,theObj;
   if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
   tmLn = document.MM_Time[tmLnName];
   if (numGotos != null)
      if (tmLn.gotoCount == null) tmLn.gotoCount = 1;
      else if (tmLn.gotoCount++ >= numGotos) {
         tmLn.gotoCount=0; return
      }
   jmpFwd = (fNew > tmLn.curFrame);
   for (i = 0; i < tmLn.length; i++) {
      sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i]; //count bkwds if jumping back
      if (sprite.charAt(0) == "s") {
         numKeyFr = sprite.keyFrames.length;
         firstKeyFr = sprite.keyFrames[0];
         lastKeyFr = sprite.keyFrames[numKeyFr - 1];
         if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue; //skip if untouchd
         for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++);
         for (j=0; j<sprite.values.length; j++) {
            props = sprite.values[j];
            if (numKeyFr == props.length) propNum = keyFrm-1 //keyframes only
            else propNum = Math.min(Math.max(0,fNew-firstKeyFr),props.length-1); //or keep in legal range
            if (sprite.obj != null) {
               if (props.prop2 == null) sprite.obj[props.prop] = props[propNum];
               else        sprite.obj[props.prop2][props.prop] = props[propNum];
            }
         }
      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
   }
   tmLn.curFrame = fNew;
   if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)');
}

function MM_findObj(n, d) { //v4.01
   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
      d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
   }
   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
   if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
   var i,p,v,obj,args=MM_showHideLayers.arguments;
   for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) {
      v=args[i+2];
      if (obj.style) {
         obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v;
      }
      obj.visibility=v;
   }
}

function MM_initTimelines() {
   //MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.
   var ns = navigator.appName == "Netscape";
   document.MM_Time = new Array(1);
   document.MM_Time[0] = new Array(7);
   document.MM_Time["Timeline1"] = document.MM_Time[0];
   document.MM_Time[0].MM_Name = "Timeline1";
   document.MM_Time[0].fps = 1;
   document.MM_Time[0][0] = new String("behavior");
   document.MM_Time[0][0].frame = 32;
   document.MM_Time[0][0].value = "MM_timelineGoto('Timeline1','1')";
   document.MM_Time[0][1] = new String("behavior");
   document.MM_Time[0][1].frame = 2;
   document.MM_Time[0][1].value = "MM_showHideLayers('news3','','hide','news2','','show','news1','','hide')";
   document.MM_Time[0][2] = new String("behavior");
   document.MM_Time[0][2].frame = 8;
   document.MM_Time[0][2].value = "MM_showHideLayers('news3','','hide','news2','','hide','news1','','show')";
   document.MM_Time[0][3] = new String("behavior");
   document.MM_Time[0][3].frame = 11;
   document.MM_Time[0][3].value = "MM_showHideLayers('news3','','show','news2','','hide','news1','','hide')";
   document.MM_Time[0][4] = new String("behavior");
   document.MM_Time[0][4].frame = 20;
   document.MM_Time[0][4].value = "MM_showHideLayers('news3','','hide','news2','','hide','news1','','show')";
   document.MM_Time[0][5] = new String("behavior");
   document.MM_Time[0][5].frame = 23;
   document.MM_Time[0][5].value = "MM_showHideLayers('news4','','show','news3','','hide','news2','','hide','news1','','hide')";
   document.MM_Time[0][6] = new String("behavior");
   document.MM_Time[0][6].frame = 31;
   document.MM_Time[0][6].value = "MM_showHideLayers('news4','','hide','news3','','hide','news2','','hide','news1','','show')";
   document.MM_Time[0].lastFrame = 32;
   for (i=0; i<document.MM_Time.length; i++) {
      document.MM_Time[i].ID = null;
      document.MM_Time[i].curFrame = 0;
      document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;
   }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
   window.open(theURL,winName,features);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
   if (init==true) with (navigator) {
      if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
         document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
      }
      }
   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
   var obj = MM_findObj(objName);
   if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
      if (theValue == true || theValue == false)
         eval("obj."+theProp+"="+theValue);
      else eval("obj."+theProp+"='"+theValue+"'");
   }
}

var already_clicked = false;
function only_click_once( submit_button ) {
   if( already_clicked == true ) {
      alert( "Your request is in progress..." );
      return false;
   }
   else{
      already_clicked = true;
      return true;
   }
}

// Recently added
function newImage(arg) {
   if (document.images) {
      rslt = new Image();
      rslt.src = arg;
      return rslt;
   }
}

function changeImages() {
   if (document.images && (preloadFlag == true)) {
      for (var i=0; i<changeImages.arguments.length; i+=2) {
         document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
      }
   }
}

var preloadFlag = false;
function preloadImages() {
   if (document.images) {
      HOME_over = newImage("bgonav/HOME-over.jpg");
      CART_over = newImage("bgonav/CART-over.jpg");
      WISH_over = newImage("bgonav/WISH-over.jpg");
      LOCATIONS_over = newImage("bgonav/LOCATIONS-over.jpg");
      ABOUT_over = newImage("bgonav/ABOUT-over.jpg");
      ARTISTS_over = newImage("bgonav/ARTISTS-over.jpg");
      CONTACT_over = newImage("bgonav/CONTACT-over.jpg");
      CART_over028 = newImage("bgonav/CART-over-28.jpg");
      WISH_over030 = newImage("bgonav/WISH-over-30.jpg");
      LOCATIONS_over032 = newImage("bgonav/LOCATIONS-over-32.jpg");
      preloadFlag = true;
   }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
   window.open(theURL,winName,features);
}

/* Show-hide DIV content. */
var state = 'none';

function showhide(layer_ref) {

   if (state == 'block') {
      state = 'none';
   }
   else {
      state = 'block';
   }
   if (document.all) { //IS IE 4 or 5 (or 6 beta)
      eval( "document.all." + layer_ref + ".style.display = state");
   }
   if (document.layers) { //IS NETSCAPE 4 or below
      document.layers[layer_ref].display = state;
   }
   if (document.getElementById &&!document.all) {
      hza = document.getElementById(layer_ref);
      hza.style.display = state;
   }
}

/* Rotating banner ads. */
function random_imglink(){
   var myimages=new Array()
   //specify random images below. You can have as many as you wish
   myimages[1]="/images/bannerads/quote11.png"

   //specify corresponding links below
   var imagelinks=new Array()
   imagelinks[1]=""

   var ry=Math.floor(Math.random()*myimages.length)

   if (ry==0)
      ry=1
   document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>')
}

function e2_tag_hide_show_toggle(elm, elmClass){
   var item = document.getElementById(elm);
   var hide = 'noDisplay';
   var unhide = elmClass;
   if(item){
      item.className = (item.className==hide)?unhide:hide;
   }
}

/** Search Suggest Feature Javascripts **/
$(document).ready(function() {
   $('input[rel="search_suggest"]').keyup( function(ev){
      var formID = $(this).parents('form:first').attr('id');
      var id = $(this).attr('id')
      var position = $('#'+id).position();
      var offsetTop = parseFloat(position.top) + $('#'+id).height() + 10;
      var offsetWidth = $('#'+id).width() + 30;
      var inputString = $(this).attr("value");
      var str = $('#'+formID).serialize() + '&formId=' + formID;
      var suggestionBoxId = $('div[rel="suggestions_box"]').attr("id");
      if(inputString.length > 1){
         $.get("search_suggest.php", str , function(data) { // Do an AJAX call
            if(data){               
               $('#'+suggestionBoxId).css({
                  'top' : offsetTop,
                  'left' : position.left,
                  'width' : offsetWidth
               });
               $('#'+suggestionBoxId).show(); // Show the suggestions box
               $('#'+suggestionBoxId).html(data); // Fill the suggestions box 
            }else{
               $('#'+suggestionBoxId).hide();
            }
            return false;
         });
      }else{
         $('#'+suggestionBoxId).hide();
      }
   });
});


$(document).ready(function() {
   $('select.search_by').change(function(){
      var searchById = $(this).attr("id");
      if(searchById == 'general_search_type'){
         var type = $(this).attr("value");
         if(type == 'c'){
            setMedia('SKC');
         }
         else if(type == 'g'){
            setMedia('SKG');
         }
         else if(type == 'd'){
            setMedia('SKD');
         }
      }
      var formID = $(this).parents('form:first').attr('id');
      var suggestionBoxId = $('div[rel="suggestions_box"]').attr("id");
      var inputString = $('input[rel="search_suggest"]').attr("value");
      var str = $('#'+formID).serialize() + '&s=' + inputString + '&formId=' + formID;
      if(inputString.length > 1){
         $.get("search_suggest.php", str , function(data) {
            if(data){
               $('#'+suggestionBoxId).empty();
               $('#'+suggestionBoxId).show();
               $('#'+suggestionBoxId).html(data);
            }else{
               $('#'+suggestionBoxId).hide();
            }
         });
      }
   });
});

$(document).ready(function() {
   $('a.suggest_link').live('click', function(){
      var inputText = $(this).attr("rel");
      var formID = $('#suggest_formId').text();
      $('#'+formID+' input[rel="search_suggest"]').attr("value", inputText);
      $('#'+formID).submit();
   });
});

function setMedia(media){
   $('#all_search_keyword').attr("name", media);
}

  
   // -->
