  // Get Cookie Value function
    function getCookieVal(offset) {
       var endstr = document.cookie.indexOf ("&", offset);
       if (endstr == -1) endstr = document.cookie.length;
       return unescape (document.cookie.substring(offset, endstr));
    }

    // Get Cookie function
    function GetCookie(name) {
       var arg = name+"=";
       var alen = arg.length;       
       var clen = document.cookie.length;
       var i = 0;
       while (i < clen) {
          var j = i + alen;
          if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
          i = document.cookie.indexOf(";", i) + 1;
          if (i == 0) break;
       }
       return "";
    }
    
    function GetCookieCount(){
        var item = new String();    
        var i =0;
        var j =0;
        i=document.cookie.indexOf("TotalItem=",0); 
        
        if(i>=0)
        {
            item = document.cookie.substring(i,i+12);
            item = item.replace("TotalItem=","").replace(";","");
            //alert(item);
            return item;    
        }
        else
        {
            return "0";
        }
    }
    
function redirect(){
    var keyword = document.getElementById("searchText").value;
}

function mmLoadMenus() {
	if (window.mm_menu_0722172754_0) return;
//	window.mm_menu_0722172754_0 = new Menu("root",124,17,"Arial, Helvetica, sans-serif",11,"#2d747a","#FFFFFF","#FFFFFF","#2d747a","left","middle",3,0,2000,-5,7,true,true,true,0,false,true);
//	window.mm_menu_0722172754_0 = new Menu("root",124,17,"Arial, Helvetica, sans-serif",11,"#2d747a","#FFFFFF","#FFFFFF","#2d747a","left","middle",3,0,2000,-5,7,true,true,true,0,false,true);
	//mm_menu_0722172754_0.addMenuItem("&nbsp;Watch&nbsp;Online","var w=window.open('/index.php?task=watchLive',null,'height=420, width=725,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no');w.focus();");
	//mm_menu_0722172754_0.addMenuItem("&nbsp;Programme&nbsp;Guide","location='?task=customerService&action=programmeGuide'");
	//mm_menu_0722172754_0.addMenuItem("&nbsp;Airing&nbsp;Now","location='/service/airing-now.asp'");
	//mm_menu_0722172754_0.addMenuItem("&nbsp;Weekly&nbsp;Recap","location='#'");
	//mm_menu_0722172754_0.addMenuItem("&nbsp;Meet&nbsp;the&nbsp;Team","location='/service/meet-the-team.asp'");
//	mm_menu_0722172754_0.hideOnMouseOut=true;
//	mm_menu_0722172754_0.bgColor='#FFFFFF';
//	mm_menu_0722172754_0.menuBorder=1;
//	mm_menu_0722172754_0.menuLiteBgColor='#FFFFFF';
//	mm_menu_0722172754_0.menuBorderBgColor='#2d747a';
	window.mm_menu_0722182430_0 = new Menu("root",124,17,"Arial, Helvetica, sans-serif",11,"#12484d","#FFFFFF","#FFFFFF","#12484d","left","middle",3,0,2000,-5,7,true,true,true,0,false,true);
	mm_menu_0722182430_0.addMenuItem("&nbsp;All&nbsp;Jewellery","location='/index.php?task=jewellerySearch&action=display&fullSelec=1'");
	//mm_menu_0722182430_0.addMenuItem("&nbsp;Anklets","location='/Jewellery/index.aspx?Category=Anklets'");
	mm_menu_0722182430_0.addMenuItem("&nbsp;Bangles","location='/index.php?task=jewellerySearch&action=search&jewellery_type=5&fullSelec=1'");
	mm_menu_0722182430_0.addMenuItem("&nbsp;Bracelets","location='/index.php?task=jewellerySearch&action=search&jewellery_type=4&fullSelec=1'");
	//mm_menu_0722182430_0.addMenuItem("&nbsp;Brooches","location='/index.php?task=jewellerySearch&action=search&jewellery_type=9&fullSelec=1'");
	//mm_menu_0722182430_0.addMenuItem("&nbsp;Chains","location='/Jewellery/index.aspx?Category=Chains'");
	//mm_menu_0722182430_0.addMenuItem("&nbsp;Cleaning&nbsp;Cloths","location='/Jewellery/index.aspx?Category=Cleaning%20Cloths'");
	mm_menu_0722182430_0.addMenuItem("&nbsp;Earrings","location='/index.php?task=jewellerySearch&action=search&jewellery_type=1&fullSelec=1'");
	//mm_menu_0722182430_0.addMenuItem("&nbsp;Men’s","location='/index.php?task=jewellerySearch&action=search&jewellery_type=2&fullSelec=1'");
	mm_menu_0722182430_0.addMenuItem("&nbsp;Necklaces","location='/index.php?task=jewellerySearch&action=search&jewellery_type=6&fullSelec=1'");
	mm_menu_0722182430_0.addMenuItem("&nbsp;Pendants","location='/index.php?task=jewellerySearch&action=search&jewellery_type=2&fullSelec=1'");
	mm_menu_0722182430_0.addMenuItem("&nbsp;Rings","location='/index.php?task=jewellerySearch&action=search&jewellery_type=3&fullSelec=1'");
	//mm_menu_0722182430_0.addMenuItem("&nbsp;Sets","location='/Jewellery/index.aspx?Category=Sets'");
	//mm_menu_0722182430_0.addMenuItem("&nbsp;Watches","location='/index.php?task=jewellerySearch&action=search&jewellery_type=8&fullSelec=1'");
	mm_menu_0722182430_0.hideOnMouseOut=true;
	mm_menu_0722182430_0.bgColor='#FFFFFF';
	mm_menu_0722182430_0.menuBorder=1;
	mm_menu_0722182430_0.menuLiteBgColor='#FFFFFF';
	mm_menu_0722182430_0.menuBorderBgColor='#2d747a';
	window.mm_menu_0722182000_0 = new Menu("root",124,17,"Arial, Helvetica, sans-serif",11,"#12484d","#FFFFFF","#FFFFFF","#12484d","left","middle",3,0,2000,-5,7,true,true,true,0,false,true);
	mm_menu_0722182000_0.addMenuItem("&nbsp;ONE&nbsp;Collection","location='/?task=oneCollection'");
	mm_menu_0722182000_0.addMenuItem("&nbsp;R&C&nbsp;Collection","location='/index.php?task=jewellerySearch&action=rAndC'");
	mm_menu_0722182000_0.addMenuItem("&nbsp;Rocks&nbsp;Star","location='/rockstar'");
	mm_menu_0722182000_0.addMenuItem("&nbsp;Rocks&nbsp;Web&nbsp;Special","location='/webspecial'");
	//mm_menu_0722182000_0.addMenuItem("&nbsp;Shimoyo&nbsp;Xmas&nbsp;Special","location='/shimoyo'");
	//mm_menu_0722182000_0.addMenuItem("&nbsp;Tony&nbsp;Diniz's&nbsp;Picks","location='/tonydiniz'");
	//mm_menu_0722182000_0.addMenuItem("&nbsp;Tonight&nbsp;with&nbsp;John&nbsp;Scott","location='?task=celebrityCelection'");
	//mm_menu_0722182000_0.addMenuItem("&nbsp;Vintage 1901","location='/Jewellery/index.aspx?Vintage=1'");
	mm_menu_0722182000_0.hideOnMouseOut=true;
	mm_menu_0722182000_0.bgColor='#FFFFFF';
	mm_menu_0722182000_0.menuBorder=1;
	mm_menu_0722182000_0.menuLiteBgColor='#FFFFFF';
	mm_menu_0722182000_0.menuBorderBgColor='#2d747a';

	window.mm_menu_0722182553_0 = new Menu("root",124,17,"Arial, Helvetica, sans-serif",11,"#12484d","#FFFFFF","#FFFFFF","#12484d","left","middle",3,0,2000,-5,7,true,true,true,0,false,true);
	mm_menu_0722182553_0.addMenuItem("&nbsp;Anniversary&nbsp;Gems","location='/index.php?task=rocksLibrary&action=anniversaryGems'");
	mm_menu_0722182553_0.addMenuItem("&nbsp;Astrological&nbsp;Gems","location='/index.php?task=rocksLibrary&action=astrologicalGems'");
	mm_menu_0722182553_0.addMenuItem("&nbsp;Birthstones","location='/index.php?task=rocksLibrary&action=birthstones'");
	mm_menu_0722182553_0.addMenuItem("&nbsp;Chinese&nbsp;Zodiac&nbsp;Gems","location='/index.php?task=rocksLibrary&action=chineseAstrologicalGems'");
	mm_menu_0722182553_0.addMenuItem("&nbsp;Colour","location='/index.php?task=rocksLibrary&action=colour'");
	mm_menu_0722182553_0.hideOnMouseOut=true;
	mm_menu_0722182553_0.bgColor='#FFFFFF';
	mm_menu_0722182553_0.menuBorder=1;
	mm_menu_0722182553_0.menuLiteBgColor='#FFFFFF';
	mm_menu_0722182553_0.menuBorderBgColor='#2d747a';
	mm_menu_0722182553_0.writeMenus();
}

function GetCustomerName()
    {
        var item = new String();    
        var i =0;
        var j =0;
        var TmpCookie ="";
        
        i=document.cookie.indexOf("CustomerName=Name=",0);      
        TmpCookie = document.cookie.substring(i,document.cookie.length)         
        j=document.cookie.indexOf(";",i); 
        
        var TxtShow="";
        if(i>=0)
        {
            if(j<0)
            {
                item = TmpCookie.substring(18,TmpCookie.length);
            }
            else
            {
                item = document.cookie.substring(i+18,j);
                //alert(item);
            }     
            //alert("xxx" + item + "xxxx");  
            if(item=="")
            {
                //TxtShow = "Welcome to Rocks &amp; Co. | ";
                TxtShow = "";
            }
            else
            {     
                TxtShow = "<span class='toptext' style='color:#2B747A'>Hello " + item + "</span>";            
            }
            
            return TxtShow;
        }
        else
        {
            //alert("xxx" + item + "xxxx");
            //return "Welcome to Rocks &amp; Co. | ";   
            return "";            
        }
    }
    
    
    function GetLogStatus()
    {
        var item = new String();    
        var i =0;
        var j =0;  
        var TmpCookie ="";
        
        i=document.cookie.indexOf("CustomerName=Name=",0);      
        TmpCookie = document.cookie.substring(i,document.cookie.length)         
        j=document.cookie.indexOf(";",i); 
        
        var TxtShow="";
        
        if(i>=0)
        {
            if(j<0)
            {
                item = TmpCookie.substring(18,TmpCookie.length);
            }
            else
            {
                item = document.cookie.substring(i+18,j);
                //alert(item);
            } 
            
            if(item=="")
            {
                //TxtShow = "<a href='https://web.server.com/MyAccount/Login.aspx'>Login</a> ";
                TxtShow = "<a href='https://www.rocksandco.com/MyAccount/Login.aspx'>Login</a> ";
            }
            else
            {     
                TxtShow = "<a href='../MyAccount/Logout.aspx'>Logout</a> ";
            }
            
            return TxtShow;
        }
        else
        {
            //return "<a href='https://web.server.com/MyAccount/Login.aspx'>Login</a> ";
            return "<a href='https://www.rocksandco.com/MyAccount/Login.aspx'>Login</a> ";
        }
    }
    
function checkKeyword(textNow,checkType)
{
	textDefault = "Keyword or Item #"
	if (checkType=="focus") 	{ 
		if (textNow==textDefault) document.search.keyword.value = ""; else document.search.keyword.value = textNow;
	} else if (checkType=="blur") {
		if (textNow==textDefault||textNow=="") document.search.keyword.value = textDefault; else document.search.keyword.value = textNow;
	}  
}

function checkKeyword2(textNow1,checkType1)
{
    textDefault1 = "Item #"
    if (checkType1=="focus") 	{ 
	    if (textNow1==textDefault1) document.getElementById("tbKeyWord").value = ""; else document.getElementById("tbKeyWord").value = textNow1;
    } else if (checkType1=="blur") {
	    if (textNow1==textDefault1||textNow1=="") document.getElementById("tbKeyWord").value = textDefault1; else document.getElementById("tbKeyWord").value = textNow1;
    }
}

function checkSubscribe(textNow,checkType)
{
	textDefault = "Your Email Address"
	if (checkType=="focus") 	{
		if (textNow==textDefault) document.Subscribe.email.value = ""; else document.Subscribe.email.value = textNow;
	} else if (checkType=="blur") {
		if (textNow==textDefault||textNow=="") document.Subscribe.email.value = textDefault; else document.Subscribe.email.value = textNow;
	}
}


/* right click solution (ie only) */
function disable(mousebutton)
{
var message = "";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3||e.which==1) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

return true;
}
//document.onmousedown = disable;

function disableselect(e){
return false;
}

function reEnable(){
return true
}

//if IE4+
//document.onselectstart=new Function ("return false")

//if NS6
//if (window.sidebar){
//document.onmousedown=disableselect
//document.onclick=reEnable
//}

