/*Functions custom SELECT BOX ----------------------------------------------------------------------------*/
<!--

/* Custom select -----------------------------------------------------------------------------------------*/
//arrays first value is 0 and must be left empty
//SELECT BOX VALUES
nbrSB = 7;
var sb1 = new Array("","All collections","Tiffany","CalvinKlein","Sarra Valentine");
var sb2 = new Array("","All jewelry","Ring","Bracelet","Earrings","Pendant","Necklace","Watches","Accessories");
var sb3 = new Array("","All materials","Silver","Gold","White gold");
var sb4 = new Array("","All Gemstones","Emerald","Sapphire","Ruby");
var sb5 = new Array("","For all","For women","For men");
var sb6 = new Array("","All prices","Under CND$250","CDN$250-500","CDN$500-1000","CDN$1000-5000","Over CDN$5000");
var sb7 = new Array("","Newest first","By lowest price","By highest price","By item name");

var sbSelected = new Array("",1,2,4,3,1,1,1);
var sbOver = "";

function defineSbOver(sb){
	//if another select box is open, close it
	if(sb!=sbOver && sbOver!=""){
		document.getElementById("sb"+sbOver+"c").style.visibility = "hidden";
	}
	sbOver = sb;
}

function over_sb(type,myDiv){
	switch(type){
		case "s":
			changeClassID('sb'+myDiv+'s-2', 'sb-over');
			MM_swapImage('arrowD'+myDiv,'','imgs/bts/arrows/a_sb_o.gif',1);									
 		 	break;    
		case "c":
			if(myDiv != undefined){
				if(myDiv.className == 'sb-c-r'){
					changeClass(myDiv,'sb-c-o');
				}
			}
  			else{
				//no myDiv means it's the Selected at the top, change the style of the div inside it
				changeClassID('sb'+sbOver+'c-2', 'sb-over');
				MM_swapImage('arrowU'+sbOver,'','imgs/bts/arrows/a_sb_o2.gif',1);
			}						
  			break;
	}
	stopTimer();
}

function out_sb(type,myDiv){
	switch(type){
		case "s":
  			changeClassID('sb'+myDiv+'s-2', 'sb-off');
			MM_swapImage('arrowD'+myDiv,'','imgs/bts/arrows/a_sb_r.gif',1);									
 		 	break;
		case "c":
			if(myDiv != undefined){
				if(myDiv.className == 'sb-c-o'){
					changeClass(myDiv,'sb-c-r');
				}
			}
			else{
				//no myDiv means it's the Selected at the top, change the style of the div inside it
				changeClassID('sb'+sbOver+'c-2', 'sb-off');
				MM_swapImage('arrowU'+sbOver,'','imgs/bts/arrows/a_sb_r2.gif',1);
			}
			break;
	}
	closeSbTimer();
}
	
function click_sb(choice){
	// if choice isn't defined the type of piece is the Selected and only needs to be show/hide
	if(choice != undefined){
		id = 'sb'+sbOver+'c'+choice;
		theClassName = document.getElementById(id).className;
			
		if(theClassName != 'sb-c-off'){
			the_sbOver = "sb"+sbOver;
			SetDiv(the_sbOver+"s-2",eval(the_sbOver)[choice]);
			SetDiv(the_sbOver+"c-2",eval(the_sbOver)[choice]);
			oldSelected = sbSelected[sbOver];
			changeClassID(the_sbOver+"c"+oldSelected,'sb-c-r');
			changeClassID(the_sbOver+"c"+choice,'sb-c-off');
			sbSelected[sbOver] = choice;
			
			//if the selected item isn't the first, put the color blue
			selected1 = the_sbOver+'s-1';
			selected2 = the_sbOver+'c-1';
			if (choice != 1){
				//only if the color isn't already blue
				if (document.getElementById(selected1).className != 'sb-s-txt-r-b'){
					changeClassID(selected1,'sb-s-txt-r-b');
					changeClassID(selected2,'sb-s-txt-r-b');
				}
			}
			else{
				changeClassID(selected1,'sb-s-txt-r');
				changeClassID(selected2,'sb-s-txt-r');
			}
			Id = "sb"+sbOver+"c";
			obj_status = document.getElementById(Id).style.visibility;
			if(obj_status=="hidden"){document.getElementById(Id).style.visibility = "visible";}
			if(obj_status=="visible"){
				document.getElementById(Id).style.visibility = "hidden";
				sbOver = "";
			}
		}
	}
	else{
		show_hide("sb"+sbOver+"c");
	}
}

function openCloseSB(){
	Id = "sb"+sbOver+"c";
	obj_status = document.getElementById(Id).style.visibility;
	if(obj_status=="hidden"){document.getElementById(Id).style.visibility = "visible";}
	if(obj_status=="visible"){
		document.getElementById(Id).style.visibility = "hidden";
		sbOver = "";
	}
}



/* TIMER CLOSE -------------------------------------------*/
/*var sbOver is defined at the begginbing of the page*/

var timerOn = false;
var timecount = 200;

function stopTimer(){
	if (timerOn) 
	{
		clearTimeout(timerID);
		timerID = null;
		timerOn = false;
	}
}

function closeSbTimer(){ 
	if(sbOver != ""){
		if (timerOn == false){
			timerID = setTimeout("closeSb()", timecount);
			timerOn = true;
		}
		if (timerOn == true){
			/*Restart timer*/
			stopTimer();
			timerID = setTimeout("closeSb()", timecount);
			timerOn = true;
		}
	}
}

function closeSb(){
	document.getElementById("sb"+sbOver+"c").style.visibility = "hidden";
	sbOver = "";
}
-->

