var std='JaipurBeads.com!'

function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
      {
      // Firefox, Opera 8.0+, Safari
      xmlHttp=new XMLHttpRequest();
      }
    catch (e)
      {
      // Internet Explorer
          
          try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
          catch (e)
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
return xmlHttp;
}

// if stone is chosen then this function
function getstonechange(str)
{
    var stonename =  str.split(",");
	window.location.href="/plistview.asp?Item="+stonename[1]+"&ItemId="+stonename[0];
}

//if both stone and shape is chosen
function getstoneshape(strstone,strshape)
{
   if(strstone.indexOf(",")>0)
   {
        var stone = strstone.split(",");
        var ItemId= stone[0];
        var stonename= stone[1];
        stonename = stonename.replace(" ","_");
    }
    if(strshape.indexOf(",")>0)
    {
        var shape = strshape.split(",");
        var shapeid = shape[0];
        var shapename = shape[1];
        shapename = shapename.replace(" ","_");        
    }   
    var url = "/plistview.asp?Item="+stonename+"_"+shapename+"&ItemId="+ItemId+","+shapeid+"";   
    window.location.href = url;
}

//if stone and price is chosen
function getstoneprice(strstone,strprice)
{
   if(strstone.indexOf(",")>0)
   {
        var stone = strstone.split(",");
        var ItemId= stone[0];
        var stonename= stone[1];
        stonename = stonename.replace(" ","_");
    }
    var url = "/plistview.asp?Item="+stonename+"&ItemId="+ItemId+"&showlimit="+strprice+"";   
    window.location.href = url;
}

//if stone , shape, price all are selected
function getstoneshapeprice(strstone,strshape,strprice)
{
   if(strstone.indexOf(",")>0)
   {
        var stone = strstone.split(",");
        var ItemId= stone[0];
        var stonename= stone[1];
        stonename = stonename.replace(" ","_");
    }
    if(strshape.indexOf(",")>0)
    {
        var shape = strshape.split(",");
        var shapeid = shape[0];
        var shapename = shape[1];
        shapename = shapename.replace(" ","_");        
    }   
    var url = "/plistview.asp?Item="+stonename+"_"+shapename+"&ItemId="+ItemId+","+shapeid+"&showlimit="+strprice+"";   
    window.location.href = url;
}

function GetPriceValue(Value1,Value2)
{
    Value1 = parseFloat(Value1)
    Value2 = parseFloat(Value2)
    var priceselect = document.getElementById("selprice");  
    priceselect.options.length = 0;
    priceselect.options[0]= new Option('<-- All Price -->','0');
    var priceoption = document.createElement('option');   
    if(Value1 == Value2)
    {
        if(Value1 <=5)
        {
            priceselect.options[priceselect.options.length] = new Option("$0.01-$5.00",1);      
            priceoption=null;
        }
        else if((Value1 > 5)&& (Value2 <= 10)) 
        {
            priceselect.options[priceselect.options.length] = new Option("$5.01-$10.00",2);      
            priceoption=null;
        }
        else if((Value1 > 10)&& (Value2 <= 20)) 
        {
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3);      
            priceoption=null;
        }
        else if((Value1 > 20)&& (Value2 <= 50)) 
        {
            priceselect.options[priceselect.options.length] = new Option("$20.01-$50.00",4);      
            priceoption=null;
        }
        else
        {
            priceselect.options[priceselect.options.length] = new Option("$50.00 +",5);      
            priceoption=null;
        }
    }
    else
    {
        if((Value1 >= 0.01 && Value2 <= 5.00))
        {       
            priceselect.options[priceselect.options.length] = new Option("$0.01-$5.00",1);      
            priceoption=null;
        }   
        else if((Value1 >= 5.01)&&(Value2 <= 10.00))
        {       
            priceselect.options[priceselect.options.length] = new Option("$5.01-$10.00",2);      
            priceoption=null;
        }   
        else if((Value1 >= 10.01)&&(Value2 <= 20.00))
        {       
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3);      
            priceoption=null;
        }  
        else if((Value1 >= 20.01)&&(Value2 <= 50.00))
        {       
            priceselect.options[priceselect.options.length] = new Option("$20.01-$50.00",4);      
            priceoption=null;
        }  
        else if((Value1 >= 50.01))
        {       
            priceselect.options[priceselect.options.length] = new Option("$50.00 + ",5);      
            priceoption=null;
        }  
        else if((Value1 > 0 && Value1 <= 5)&&(Value2 <= 10))
        {       
            priceselect.options[priceselect.options.length] = new Option("$0.01-$5.00",1);  
            priceselect.options[priceselect.options.length] = new Option("$5.01-$10.00",2);    
            priceoption=null;
        }   
        else if((Value1 <= 5 && Value1 > 0)&&(Value2 <= 20))
        {       
            priceselect.options[priceselect.options.length] = new Option("$0.01-$5.00",1);  
            priceselect.options[priceselect.options.length] = new Option("$5.01-$10.00",2); 
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3);      
            priceoption=null;
        }
        else if((Value1 <= 5 && Value1 > 0)&&(Value2 <= 50))
        {       
            priceselect.options[priceselect.options.length] = new Option("$0.01-$5.00",1);  
            priceselect.options[priceselect.options.length] = new Option("$5.01-$10.00",2); 
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3);      
            priceselect.options[priceselect.options.length] = new Option("$20.01-$50.00",4); 
            priceoption=null;
        }   
        else if((Value1 <= 5 && Value1 > 0)&&(Value2 > 50))
        {       
            priceselect.options[priceselect.options.length] = new Option("$0.01-$5.00",1);  
            priceselect.options[priceselect.options.length] = new Option("$5.01-$10.00",2); 
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3);      
            priceselect.options[priceselect.options.length] = new Option("$20.01-$50.00",4); 
            priceselect.options[priceselect.options.length] = new Option("$50.00 + ",5); 
            priceoption=null;
        } 
        else if((Value1 > 5 && Value1 <= 10)&&(Value2 <= 20))
        {       
            priceselect.options[priceselect.options.length] = new Option("$5.01-$10.00",2);    
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3);  
            priceoption=null;
        }     
        else if((Value1 > 5 && Value1 <= 10)&&(Value2 <= 50))
        {       
            priceselect.options[priceselect.options.length] = new Option("$5.01-$10.00",2);    
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3);  
            priceselect.options[priceselect.options.length] = new Option("$20.01-$50.00",4); 
            priceoption=null;
        }
        else if((Value1 > 5 && Value1 <= 10)&&(Value2 > 50))
        {       
            priceselect.options[priceselect.options.length] = new Option("$5.01-$10.00",2); 
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3);      
            priceselect.options[priceselect.options.length] = new Option("$20.01-$50.00",4); 
            priceselect.options[priceselect.options.length] = new Option("$50.00 + ",5); 
            priceoption=null;
        } 
        else if((Value1 > 10 && Value1 <= 20)&&(Value2 <= 50))
        {       
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3); 
            priceselect.options[priceselect.options.length] = new Option("$20.01-$50.00",4);  
            priceoption=null;
        }  
        else if((Value1 > 10 && Value1 <= 20)&&(Value2 > 50))
        {
            priceselect.options[priceselect.options.length] = new Option("$10.01-$20.00",3); 
            priceselect.options[priceselect.options.length] = new Option("$20.01-$50.00",4);  
            priceselect.options[priceselect.options.length] = new Option("$50.00 + ",5); 
            priceoption=null;
        } 
        else if((Value1 > 20 && Value1 <= 50)&&(Value2 > 50 ))
        {       
            priceselect.options[priceselect.options.length] = new Option("$20.01-$50.00",4);
            priceselect.options[priceselect.options.length] = new Option("$50.00 + ",5);  
            priceoption=null;
        } 
     }    
}


function changeaction(act,msg){
	if (act == 'del'){ 
		if (window.confirm("ARE YOU SURE ?? \n\n Click OK to delete " + msg + ", else click Cancel.")) return true; else  return false; 
	}
}

function isNumber(xpara){
	if ( (isNaN(xpara)) ||(xpara=="") ) return false; else return true;
}

function NumorEmpty(xpara){  
	if ((isNaN(xpara))&&(xpara!="")) return false; else return true;
}		


//Function used to validateaty login name and password

function CheckLogin(txtValue,nWhat){
	var nLen,sCharAllowed,flag;
	flag=true;
	sCharAllowed="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_@.";
	nLen = txtValue.length;
	if(nLen<4 || nLen>20)
		flag=false;
	for(var nLoop=0;nLoop<=nLen;nLoop++){
		if(sCharAllowed.indexOf(txtValue.charAt(nLoop))== -1){
			flag=false;
			break;
		}
	}
	if (flag)
		return true;
	else{
		if (nWhat == 1)
			alert("Invalid Login Name !!" + "\n\n" + " Login Name must be a single alphanumeric \n word between 4 to 20 characters.");
		else
			alert("Invalid Password !!" + "\n\n" + " Password must be a single alphanumeric \n word between 4 to 20 characters.");
		return false;
	}	
}
function CheckNumber(GivenValue){
	var sNumberAllowed,nLen;
	sNumberAllowed="0123456789.";
	nLen=GivenValue.length;
	for(var nLoop=0;nLoop<=nLen;nLoop++){
		if(sNumberAllowed.indexOf(GivenValue.charAt(nLoop)) == -1)
			return false;
	}
	return true;
}

function openWin(fName,winName,width,height) {
	popupWin = window.open(''+fName+'', ''+winName+'', 'width='+width+',height='+height+',resizable,menubar=yes,left=10,top=10,screenX=10,screenY=10')
}

function QuantityCheck(nQty,nBal,nMoq ){
	if(isNaN(nQty)){
		alert("please enter number only in quantity box");
		return false;
	}
	if (nQty == "" || nQty==0){
		alert("Please enter Quantity");
		return false;
	}
	if (nQty < nMoq){
		alert("Quantity should be greater then MOQ.");
		return false;
	}
	if (nQty > nBal) {
		alert("Quantity should be less then quantity balance.");
		return false;
	}
	return true;
}
		
function DateCheck(oFrm){
	var nDD,nMM,nYY;
	nDD=oFrm.lstDD.options[oFrm.lstDD.selectedIndex].value;
	nMM=oFrm.lstMM.options[oFrm.lstMM.selectedIndex].value-1;
	nYY=oFrm.lstYY.options[oFrm.lstYY.selectedIndex].value;
	var dtCheck = new Date(nYY,nMM,nDD);
	if (nMM!=dtCheck.getMonth()){
		alert("Invalid Date");
		return false;	
	}
	return true;
}

function CheckBoxCheck(oFrm){
	for (var nLoop=0;nLoop<oFrm.elements.length;nLoop++){
		if (oFrm.elements[nLoop].type=="checkbox"){
			if (oFrm.elements[nLoop].checked == true){
				return true;
			}
		} 
	}
	alert('please select at least one item to proceed ');
	return false;
}
function CheckEmail(TxtBx){
	if((TxtBx.value.search("@") == -1) || (TxtBx.value.search("[.*]") == -1)){ 
 		return false;
	} 		
	return true;
}


function changecurwindow(){

window.open('/changecur.asp?shref=' + window.location.href,1,"height=190,width=320,status='0',toolbar='0',menubar='0',location='0',titlebar='0',hotkeys='0',resize='0'");
}


function sortwindow(){

window.open('sortorder.asp?shref=' + window.location.href,1,"height=190,width=200,status=no,toolbar=no,menubar=no,location=no");

}

//tooltip function

	//general properties:
 	var _tooltipPauseBeforeShow=100; //miliseconds to pause before showing the tooltip.
 	var _tooltipDelay=60; //seconds before auto hiding. set 0 to make it permanent.
 	var _tooltipBgColor="white"; //background color of tooltip box
 	var _tooltipTextColor="black"; //color of tooltip text.
 	var _tooltipFontFamily="verdana"; //font family of tooltip text.
 	var _tooltipFontSize=12; //font size of tooltip text.
 	var _tooltipFontBold=true; //whether the tooltip text will be bold or not
 	
 	//private data:
 	var _tooltipContainerName="TooltipContainer_V1";
 	
 	window.onload=function WindowLoad(event)
 	{
 		var arrSpans=document.getElementsByTagName("span");
 		var tooltipCount=0;
 		for (var i=0; i<arrSpans.length; i++)
 		{
 			var objSpan=arrSpans[i];
 			if ((objSpan.attributes["tooltip_v1"])&&(objSpan.attributes["tooltip_v1"].value.length > 0))
 			{
 				objSpan.onmouseover = ShowToolTip;
 				//objSpan.onmouseout = HideToolTip;
 				tooltipCount++;
 			}
 		}
 		//if (tooltipCount > 0)
 			//document.onclick=HideToolTip;
 	}
 
 	function ShowToolTip(event)
 	{
 		//get windows event:
 		if ((typeof event == "undefined")||(!event))
 			event = window.event;
 		
 		//get container:
 		var objContainer=document.getElementById(_tooltipContainerName);
 		
 		//get source element:
 		var objSource=event.srcElement||event.target;
 		
 		//abort if no source available:
 		if ((typeof objSource == "undefined")||(!objSource))
 			return false;
 		
 		//create if does not exist:
 		if (!objContainer)
 		{
 			objContainer = document.createElement("div");
 			objContainer.id = _tooltipContainerName;
 			objContainer.style.backgroundColor = _tooltipBgColor;
 			objContainer.style.color = _tooltipTextColor;
 			objContainer.style.fontFamily = _tooltipFontFamily;
 			objContainer.style.fontSize = _tooltipFontSize;
 			if (_tooltipFontBold)
 				objContainer.style.fontWeight = "bold";
 			objContainer.style.position = "absolute";
 			objContainer.style.display = "none";
 			document.body.appendChild(objContainer);
 		}
 		
 		//get mouse position:
 		var mouseX=event.x||event.pageX;
 		var mouseY=event.y||event.pageY;
 		
 		//get body scroll:
 		var scrollX=document.body.scrollLeft;
 		var scrollY=document.body.scrollTop;
 		
 		//set container position:
 		objContainer.style.left = (mouseX+scrollX)+"px";
 		objContainer.style.top = (mouseY+scrollY)+"px";
 		
 		//read tooltip text:
 		var strText=(objSource.attributes["tooltip_v1"])?objSource.attributes["tooltip_v1"].value:"";
 		
 		//verify we have something to display:
 		if (strText.length == 0)
 			return false;
 		
 		//set container text:
 		objContainer.innerHTML = strText;
 		
 		//show container:
 		setTimeout("_ShowTooltipContainer();", _tooltipPauseBeforeShow);
 		
 		//set timer if needed:
 		if (_tooltipDelay > 0)
 			setTimeout("HideToolTip();", _tooltipDelay*1000);
 		
 		return true;
 	}
 	
 	
 	function HideToolTip(event)
 	{
 		//get container:
 		var objContainer=document.getElementById(_tooltipContainerName);
 		if (objContainer)
 		{
 			objContainer.style.display = "none";
 		}
 	}
 	
 	function _ShowTooltipContainer()
 	{
 		//get container:
 		var objContainer=document.getElementById(_tooltipContainerName);
 		
 		if (objContainer)
 		{
 			objContainer.style.display = "block";
 		}
 	}



function ForgotPwd(){

	window.open( "/forgotpwd.asp?UserName=" + document.LoginForm2.UserName.value, "Forgot", 'resizable, width=400, height=225, left=100, top=100, screenX=100, screenY=100');
}



//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="/member/m-area.asp?cstatus=2">MY CART</a>'
menu1[1]='<a href="/member/editprofile.asp">EDIT PROFILE</a>'
menu1[2]='<a href="/member/m-acstatement.asp">ORDER STATUS</a>'
menu1[3]='<a href="/customorder.asp?ppid=2">CUSTOM ORDER REQUEST</a>'
menu1[4]='<a href="/contactus.asp?type=1">FEEDBACK</a>'

//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="/docs/quality.asp">QUALITY ASSURANCE</a>'
menu2[1]='<a href="/docs/CustomerService.asp">CUSTOMER CARE</a>'



var menu3=new Array()
menu3[0]='<a href="/docs/moq.asp">ORDER POLICY</a>'
menu3[1]='<a href="/docs/payment.asp">PAYMENT</a>'

menu3[3]='<a href="/docs/return.asp">RETURN</a>'

		
var menuwidth='140px' //default menu width
var menubgcolor='#ffffff' //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu


