if(document.layers){

	_browser = "nn";

}

if(document.all){

	_browser = "ie";

}

if(navigator.userAgent.toLowerCase().match("gecko")){

	_browser= "gecko";

}



/* //////////////////////////////////////// */

/*        Add By Sarun Chinskul             */  

/* //////////////////////////////////////// */



function menu_top_control( status ) {

 var f = document.all ? document.all.topMenu : document.topMenu

     if ( status == "2" ) {

        document.getElementById("subtop_earring").style.display

     }

}



function menu_left_control( status ) {

 var f = document.all ? document.all.searchForm : document.searchForm

 var tmp,tmp_show,dhlink  



   var DHSITE = 'http://www.diamondharmony.com/' //indianic



     if       ( status == "1" ) {

       tmp = document.getElementById("sub_bridals").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_bridals").style.display = tmp_show

       if ( tmp_show == "block" ) {

          // window.location = DHSITE+'index.php?p=page&page_id=BridalGallery&sub_bridals=yes'

          window.location = DHSITE+'collections/BridalGallery.html'

       }  

    } else if ( status == "2" ) {

       tmp = document.getElementById("sub_earrings").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_earrings").style.display = tmp_show

       if ( tmp_show == "block" ) {

          // window.location = DHSITE+'index.php?p=page&page_id=Earrings&sub_earrings=yes'

          window.location = DHSITE+'collections/Earrings.html'

       }  

    } else if ( status == "3" ) {

       tmp = document.getElementById("sub_rings").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_rings").style.display = tmp_show

       if ( tmp_show == "block" ) {

          // window.location = DHSITE+'index.php?p=page&page_id=Rings&sub_rings=yes'

          window.location = DHSITE+'collections/Rings.html'

       }  

    } else if ( status == "4" ) {

       tmp = document.getElementById("sub_bracelets").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_bracelets").style.display = tmp_show

       if ( tmp_show == "block" ) {

          // window.location = DHSITE+'index.php?p=page&page_id=Bracelets&sub_bracelets=yes'

          window.location = DHSITE+'collections/Bracelets.html'

       }  

    } else if ( status == "5" ) {

       tmp = document.getElementById("sub_pendants").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_pendants").style.display = tmp_show

       if ( tmp_show == "block" ) {

          // window.location = DHSITE+'index.php?p=page&page_id=Pendants&sub_pendants=yes'

          window.location = DHSITE+'collections/Pendants.html'

       }  

    } else if ( status == "6" ) {

       tmp = document.getElementById("sub_necklaces").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_necklaces").style.display = tmp_show

       if ( tmp_show == "block" ) {

          // window.location = DHSITE+'index.php?p=page&page_id=Necklaces&sub_necklaces=yes'

          window.location = DHSITE+'collections/Necklaces.html'

       }  

    } else if ( status == "7" ) {

       tmp = document.getElementById("sub_special").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_special").style.display = tmp_show

       if ( tmp_show == "block" ) {

          // window.location = DHSITE+'index.php?p=page&page_id=Special&sub_special=yes'

          window.location = DHSITE+'collections/Special.html'

       }  

    } else if ( status == "8" ) {

       tmp = document.getElementById("sub_gift").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_gift").style.display = tmp_show

       if ( tmp_show == "block" ) {

          window.location = DHSITE+'index.php?p=page&page_id=Gift&sub_gift=yes'

       }  

    } else if ( status == "9" ) {

       tmp = document.getElementById("sub_family").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_family").style.display = tmp_show

       if ( tmp_show == "block" ) {

          //window.location = DHSITE+'index.php?p=page&page_id=Family&sub_family=yes'  // Removed by Sarun 08-DEC-2007

          window.location = DHSITE+'collections/Family_Jewelry.html'

       }  

    } else if ( status == "10" ) {

       tmp = document.getElementById("sub_religious").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_religious").style.display = tmp_show

       if ( tmp_show == "block" ) {

          // window.location = DHSITE+'index.php?p=page&page_id=Religious&sub_religious=yes' / Removed by Sarun 08-DEC-2007

          window.location = DHSITE+'collections/Religious.html'

       }  

    } else if ( status == "11" ) {

       tmp = document.getElementById("sub_mens").style.display

          if ( tmp == "block" ) { tmp_show = "none" }

          else                  { tmp_show = "block" } 

       document.getElementById("sub_mens").style.display = tmp_show

       if ( tmp_show == "block" ) {

          // window.location = DHSITE+'index.php?p=page&page_id=mens_jewelry&sub_mens=yes'

          window.location = DHSITE+'collections/Men_Jewelry.html'

       }  

    } else if ( status == "100" ) {

       //tmp = document.getElementById("sub_stack").style.display

       //   if ( tmp == "block" ) { tmp_show = "none" }

       //   else                  { tmp_show = "block" } 

       //document.getElementById("sub_stack").style.display = tmp_show

       //if ( tmp_show == "block" ) {

          window.location = DHSITE+'collections/Stackable_Ring.html'

       //}  

    }



}





function sub_left_control( parentid ) {

   var f = document.all ? document.all.searchForm : document.searchForm 

   var sub_menu

 

   var DHSITE = 'http://www.diamondharmony.com/' //indianic



   if        ( parentid == "21" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_bridals=yes' 

        window.location = DHSITE+'collections/Semimounts-21-1.html'

   } else if ( parentid == "20" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_bridals=yes' 

        window.location = DHSITE+'collections/Three_Stone_Rings-20-1.html'

   } else if ( parentid == "19" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_bridals=yes' 

        window.location = DHSITE+'collections/Bridal_Sets-19-1.html'

   } else if ( parentid == "18" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_bridals=yes' 

        window.location = DHSITE+'anniversary_bands.html'

   } else if ( parentid == "102" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_bridals=yes' 

        window.location = DHSITE+'collections/Eternity_Rings-102-1.html'





   } else if ( parentid == "22" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_earrings=yes' 

        window.location = DHSITE+'collections/Diamond-22-1.html'

   } else if ( parentid == "23" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_earrings=yes' 

        window.location = DHSITE+'collections/Studs-23-1.html'

   } else if ( parentid == "24" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_earrings=yes' 

        window.location = DHSITE+'collections/Gemstones-24-1.html'

   } else if ( parentid == "25" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_earrings=yes' 

        window.location = DHSITE+'collections/Pearl-25-1.html'

   } else if ( parentid == "26" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_earrings=yes' 

        window.location = DHSITE+'collections/Charms-26-1.html'





   } else if ( parentid == "12" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_rings=yes' 

        window.location = DHSITE+'collections/Diamond-12-1.html'

   } else if ( parentid == "13" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_rings=yes' 

        window.location = DHSITE+'collections/Gem_Stone-13-1.html'

   } else if ( parentid == "16" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_rings=yes' 

        window.location = DHSITE+'collections/Pearl-16-1.html'

   } else if ( parentid == "17" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_rings=yes' 

        window.location = DHSITE+'collections/Stackable_Rings-17-1.html'

   } else if ( parentid == "bd" ) { 

        // window.location = DHSITE+'index.php?p=page&page_id=BridalGallery&sub_bridals=yes' 

        window.location = DHSITE+'collections/BridalGallery.html'





   } else if ( parentid == "32" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_bracelets=yes' 

        window.location = DHSITE+'collections/Diamond-32-1.html'

   } else if ( parentid == "33" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_bracelets=yes' 

        window.location = DHSITE+'collections/Gem_Stone-33-1.html'

   } else if ( parentid == "35" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_bracelets=yes' 

        window.location = DHSITE+'collections/Anklets-35-1.html'

   } else if ( parentid == "36" ) {

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_bracelets=yes' 

        window.location = DHSITE+'collections/Charms-36-1.html'





   } else if ( parentid == "37" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_pendants=yes' 

        window.location = DHSITE + 'collections/Diamond-37-1.html' 

   } else if ( parentid == "38" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_pendants=yes' 

        window.location = DHSITE + 'collections/Gem_Stone-38-1.html' 

   } else if ( parentid == "39" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_pendants=yes' 

        window.location = DHSITE + 'collections/Pearl-39-1.html' 

   } else if ( parentid == "cr" ) { 

        // window.location = DHSITE+'index.php?p=page&page_id=Crosses&sub_pendants=yes' 

        window.location = DHSITE + 'collections/Crosses.html' 

   } else if ( parentid == "ht" ) { 

        // window.location = DHSITE+'index.php?p=page&page_id=Hearts&sub_pendants=yes' 

        window.location = DHSITE + 'pages/Hearts.html' 

   } else if ( parentid == "45" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_pendants=yes' 

        window.location = DHSITE + 'collections/Martinis-45-1.html' 





   } else if ( parentid == "50" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_necklace=yes' 

        window.location = DHSITE + 'collections/Diamond-50-1.html' 

   } else if ( parentid == "51" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_necklace=yes' 

        window.location = DHSITE + 'collections/Gem_Stone-51-1.html' 

   } else if ( parentid == "54" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_necklace=yes' 

        window.location = DHSITE + 'collections/Diamond_By_The_Yard-54-1.html' 





   } else if ( parentid == "70" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_special=yes' 

        window.location = DHSITE + 'collections/Martinis-70-1.html' 

   } else if ( parentid == "54" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_special=yes' 

        window.location = DHSITE + 'collections/Diamond_By_The_Yard-54-1.html' 

   } else if ( parentid == "72" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_special=yes' 

        //window.location = DHSITE + 'collections/Charms_Earring-72-1.html' //indianic

        window.location = DHSITE + 'pages/charms.html' 

   } else if ( parentid == "73" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_special=yes' 

        window.location = DHSITE + 'pages/circleOfLove.html' 

   } else if ( parentid == "74" ) { 

        // window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_special=yes' 

        window.location = DHSITE + 'collections/Rainbow_Gem-74-1.html' 

   } else if ( parentid == "75" ) { 

		// window.location = DHSITE+'index.php?p=catalog&parent='+parentid+'&pg=1&sub_special=yes' 

		window.location = DHSITE + 'pages/d-tots.html' 

   

	}else if ( parentid == "63" ) { 

                window.location = DHSITE + 'collections/HIM-63-1.html' 

	}else if ( parentid == "64" ) { 

                window.location = DHSITE + 'catalog/New_Moms-203-1.html' 

	}else if ( parentid == "65" ) { 

                window.location = DHSITE + 'collections/HER-65-1.html' 

	}else if ( parentid == "66" ) { 

                window.location = DHSITE + 'collections/Mother_s_day-66-1.html' 

	}else if ( parentid == "67" ) { 

                window.location = DHSITE + 'collections/Bridesmaid-67-1.html' 

	}else if ( parentid == "76" ) { 

                window.location = DHSITE + 'pages/Initials.html' 

	}else if ( parentid == "77" ) { 

                window.location = DHSITE + 'collections/Weddingbands.html' 

	}else if ( parentid == "78" ) { 

				window.location = DHSITE + 'catalog/Hoop_Earrings-101-1.html' 

	}else if ( parentid == "79" ) { 

				window.location = DHSITE + 'catalog/Bangles-118-1.html' 

	}else if ( parentid == "80" ) { 

				// window.location = DHSITE + 'pages/birthstones.html'     /* Removed by Sarun 08-DEC-2007 */

				window.location = DHSITE + 'collections/BirthStones.html' 

	}else if ( parentid == "81" ) { 

				window.location = DHSITE + 'pages/studs.html' 

	}else if ( parentid == "82" ) { 

				// window.location = DHSITE + 'pages/charms.html'    /* Removed by Sarun 08-DEC-2007 */

				window.location = DHSITE + 'collections/Charms.html' 

////////////////////////////////////////// 

        // Added by Sarun Chisnkul 14-OCT-2006

        ////////////////////////////////////////// 

	//}else if ( parentid == "78" ) { //indianic this number is used for Hoops

    //            window.location = DHSITE + 'pages/journey.html' 

	}else if ( parentid == "83" ) { //indianic (new number given and left_menu.html and site_top.html updated)

                window.location = DHSITE + 'pages/journey.html' 

	}



}

/* //////////////////////////////////////// */





function isEmail(entry){

	var rex= /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,5})(\]?)$/;

	return rex.test(entry);

}



function delay(gap){ /* gap is in millisecs */

	var then, now; 

	then = new Date().getTime();

	now = then;

	while((now-then) < gap){

		now=new Date().getTime();

	}

}



function EnlargeImage(url, w, h){

	if(bWin){

		bWin.close();

	}

	var bWin = null;

	var ww = w*1+20;

	var hh = h*1+20;

	if(ww < 100)ww = 100;

	if(hh < 100)hh = 100;

	bWin = window.open(

		url,

		"ZoomImgWin", 

		"titlebar=yes, toolbar=no, menubar=no, status=yes, directories=no, resizable=yes, scrollbars=no, top=20, left=20, width=" + ww + ", height=" + hh

	);

	while(bWin==null);

	bWin.focus();

	bWin.moveTo(20, 20);

	bWin.resizeTo(ww+15, hh+50);

}



function showPrinterPage(url){

	var prWin = null;

	prWin = window.open(

		url,

		"PrintVer", 

		"titlebar=yes, toolbar=no, menubar=yes, status=yes, directories=no, resizable=yes, scrollbars=yes, top=20, left=20, width=810, height=600"

	);

	while(prWin==null);

	prWin.focus();

}



function OnButton(bt){

	document.images[bt].src = skin_images + bt + "_on.gif";

	

}

function OffButton(bt){

	document.images[bt].src = skin_images + bt + "_off.gif";

}



function OnMenu(cid){

	document.images["menul_" + cid].src = skin_images + "catl_bg_on.gif";

	document.all["menur_" + cid].background = skin_images + "catr_bg_on.gif";

}

function OffMenu(cid){

	document.images["menul_" + cid].src = skin_images + "catl_bg_off.gif";

	document.all["menur_" + cid].background = skin_images + "catr_bg_off.gif";

}

var RecentTimeOut, CartTimeOut;



function ShowCart(){

	window.clearTimeout(CartTimeOut);

	if(_browser == "ie"){

		cartDiv.style.visibility = 

			cartDiv.style.visibility == "hidden"?"visible":"hidden";

			document.images["cartImage"].src =

				cartDiv.style.visibility == "hidden"?

				(skin_images + "ic_expand.gif"):

				(skin_images + "ic_collapse.gif");

	}

	else if(_browser == "gecko"){

		document.getElementById('cartDiv').style.visibility = 

			document.getElementById('cartDiv').style.visibility == "hidden"?"visible":"hidden";

		document.images["cartImage"].src =

			document.getElementById('cartDiv').style.visibility == "hidden"?

			(skin_images + "ic_expand.gif"):

			(skin_images + "ic_collapse.gif");

	}

	else{

		document.cartDiv.visibility = document.cartDiv.visibility  == "hidden"?"visible":"hidden";

	}

}





function ShowRecent(){

	window.clearTimeout(RecentTimeOut);

	if(_browser == "ie"){

		recentDiv.style.visibility = 

			recentDiv.style.visibility == "hidden"?"visible":"hidden";

		document.images["recentImage"].src =

			recentDiv.style.visibility == "hidden"?

			(skin_images + "ic_expand.gif"):

			(skin_images + "ic_collapse.gif");

	}

	else if(_browser == "gecko"){

		document.getElementById('recentDiv').style.visibility = 

			document.getElementById('recentDiv').style.visibility == "hidden"?"visible":"hidden";

		document.images["recentImage"].src =

			document.getElementById('recentDiv').style.visibility == "hidden"?

			(skin_images + "ic_expand.gif"):

			(skin_images + "ic_collapse.gif");

	}

	else{

		document.recentDiv.visibility = document.recentDiv.visibility  == "hidden"?"visible":"hidden";

	}

}



function PopUpCart(){

	CartTimeOut = window.setTimeout('ShowCart();', 1000);

}



function PopUpRecent(){

	RecentTimeOut = window.setTimeout('ShowRecent();', 1000);

}



function OnMenu(img){

	document.images[img].src = skin_images + "menu_arrow_on.gif";

}

function OffMenu(img){

	document.images[img].src = skin_images + "menu_arrow.gif";

}



function ShowPopup(src){

	var bWin = null;

	bWin = window.open(

		src, 

		"PopupWind", 

		"titlebar=no, toolbar=no, menubar=no, status=no, directories=no, resizable=no, scrollbars=no, top=20, left=20, width=320, height=240"

	);

	while(bWin==null);

	bWin.focus();

}



function PopUpImage(image_source, image_width, image_height){

	var bWin = null;

	bWin = window.open(

		image_source, 

		"ImageWind", 

		"titlebar=no, toolbar=no, menubar=no, status=no, directories=no, resizable=no, scrollbars=no, top=20, left=20, width=" + (image_width + 20) + ", height=" + (image_height + 20)

	);

	while(bWin==null);

	bWin.focus();

}



function ConfirmLogout(){

	if(orderItemsCount > 0){

		if(confirm("You have items in your cart. Logging out will empty your cart\nAre you sure want to continue?")){

			document.location = urlLogout;

		}

	}

	else{

		if(confirm("Do you really want to logout?")){

			document.location = urlLogout;

		}

	}

}



function CartConfirmDeleteItem(ocid){

	if(confirm("Do you really want delete selected item?")){

		document.location = CartDeleteItemUrl + '&ocid=' + ocid;

	}

}

function CartConfirmEmpty(){

	if(confirm("Do you really want empty cart?")){

		document.location = CartEmptyUrl;

	}

}



//indianic - add items to compare

function CompareAddItem(itemid) {

var produrl=document.URL;

produrl+=(produrl.indexOf('?')<0) ? "?itemid=" : "&itemid=";

produrl+=itemid;

document.location=produrl;

}

//indianic - add items to compare



//indianic - compare items confirm before removal

function CompareConfirmDeleteItem(itemid) {

if (confirm("Do you really want remove given item(s)?")) {

var produrl=document.URL;

produrl+=(produrl.indexOf('?')<0) ? "?itemid=" : "&itemid=";

produrl+=itemid;

document.location=produrl;

}

}

//indianic - compare items confirm before removal



//indianic - compare items page break

function ComparePageBreak(itempg) {

var produrl=document.URL;

produrl+=(produrl.indexOf('?')<0) ? "?itempg=" : "&itempg=";

produrl+=itempg;

document.location=produrl;

}

//indianic - compare items page break



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;

}



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_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];}

}

