// JScript source code
<!--
// new script start here

//search text validation start here

function adsearch_category()
{
//alert(document.frm_advancesearch.category.value);
}

function adsearch_pricesel()
{
//alert(document.frm_advancesearch.price.value);
}

function adsearch_gemstone()
{
//alert(document.frm_advancesearch.gemstone.value);
}

function adsearch_go()
{
if ( Trim(document.frm_advancesearch.category.value)==0  && Trim(document.frm_advancesearch.metal.value)==0 && Trim(document.frm_advancesearch.gemstone.value)==0 && Trim(document.frm_advancesearch.price.value)==0) 
	{
		alert ("No Result for Empty Data");
		document.frm_advancesearch.category.focus();
		return false;
	}
	else
	{
//		alert(document.frm_advancesearch.category.value);
	//	alert(document.frm_advancesearch.price.value);
//		alert(document.frm_advancesearch.gemstone.value);
		document.frm_advancesearch.submit();
	}
}



function searchprod()
{
	if (Trim(document.searchqry.searchproduct.value)=='')
		{
			alert ("Blank Text not accepted");
			document.searchqry.searchproduct.focus();
			return false;
		}
	else
		{
			document.searchqry.allvalue.value = document.searchqry.searchproduct.value;
		}
}

function searchgo(a)
{
	if (a==1)
		{
			if (Trim(document.searchqry.searchproduct.value)=='$' || Trim(document.searchqry.searchproduct.value)=='Rs.' || Trim(document.searchqry.searchproduct.value)=='Rs' || Trim(document.searchqry.searchproduct.value)=='RS.' || Trim(document.searchqry.searchproduct.value)=='RS' || Trim(document.searchqry.searchproduct.value)=='rs') 
				{
					alert ("Not accepted");
					document.searchqry.searchproduct.focus();
					return false;
				}

			if (Trim(document.searchqry.searchproduct.value)=='') 
				{
					alert ("Blank Text not accepted");
					document.searchqry.searchproduct.focus();
					return false;
				}
			else
				{
					document.searchqry.allvalue.value = document.searchqry.searchproduct.value;
					document.searchqry.select2_Criteria.value = 1;
					document.searchqry.submit();
				}
		}

	else
		if (a==3)
		{
			if (criteria_no==0)
				{
					alert ("Price not selected");
					return false;
				}
			else
				{
					document.searchqry.submit();
				}
		}
}
// search text validation end here


//Start check subscribe email id function
function  chk_subscribe_emailid()
{
	if (Trim(document.formsubscribe.subscribeemailid.value)=='' || document.formsubscribe.subscribeemailid.value.length<9 )
		{
			if (Trim(document.formsubscribe.subscribeemailid.value)=='')
				{
					alert("Blank Subscribe Email Id not accepted");
					document.formsubscribe.subscribeemailid.focus();
					return false;
				}
			else
				{
					alert("Subscribe Email Id less than 9 character");
					document.formsubscribe.subscribeemailid.focus();
					return false;
				}
		}
	else
		{
			str1=Trim(document.formsubscribe.subscribeemailid.value);
			var b=0;	

			for (i=0;i<document.formsubscribe.subscribeemailid.value.length;i++)				
				{
					a= str1.substr([i],1);
					if (a=='@' || a=='.')	
						{
							b=b+1;	
						}	
				
				}				
					if (b<2)	
						{
							document.formsubscribe.subscribeemailid.focus();
							alert("Invalid Subscribe Email Id");
							return false;
						}
					else
						{	
							document.formsubscribe.submit();
						}
		}
}
//End check subscribe email id function




//new script end here



function zoomIt1(i)
{
	file="Zoom_new.asp?zoom="+i;
	window.open(file,'edit','height=550,width=525,left=200,top=148,resizable=no');
}

function onClose()
{
	if (window.event.clientX < 0 && window.event.clientY < 0)
	{
		document.location.href='trijewelsclose_new.asp';
	}
}

function aucpopup(i)
{
	file=i;
	window.open(file,'edit','height=550,width=525,left=200,top=148,resizable=no');
}


function sorttype()
{
	document.homevalue.sort_type.value =eval('document.homevalue.sort_type.options[document.homevalue.sort_type.selectedIndex].value');
}

function sortgo(i)
{
	var a,b
	a = document.homevalue.cat.value;
	b = eval('document.homevalue.sort_type.options[document.homevalue.sort_type.selectedIndex].value');

	if (i==1)
	{
		document.location.href ='diamond_category_new.asp?cat='+a+'&sortcat='+b ;
	}
	if (i==4)
	{
		document.location.href ='diamond_category_list_new.asp?cat='+a+'&sortcat='+b ;
	}

	if (i==2)
	{
		var c,d
		c=document.homevalue.sc.value;
		d=document.homevalue.catname.value;
		document.location.href ='diamond_subcategory_new.asp?cat='+a+'&sortcat='+b+'&sc='+c+'&catname='+d;
	}
	if (i==5)
	{
		var c,d
		c=document.homevalue.sc.value;
		d=document.homevalue.catname.value;
		document.location.href ='diamond_subcategory_list_new.asp?cat='+a+'&sortcat='+b+'&sc='+c+'&catname='+d;
	}
	if (i==3)
	{
		var c,d
		c=document.homevalue.gemstone.value;
		d=document.homevalue.price.value;
		e=document.homevalue.metal.value;
		document.location.href ='advancesearch_results_new.asp?category='+a+'&sortcat='+b+'&gemstone='+c+'&price='+d+'&metal='+e;
	}

}
function sortgoBestSeller(i)
{
	var a,b
	a = document.homevalue.cat.value;
	b = eval('document.homevalue.sort_type.options[document.homevalue.sort_type.selectedIndex].value');
	brandname = eval('document.homevalue.brandname.value');

	if (i==1)
	{
		document.location.href ='promotional_offer_new.asp?brandname='+brandname+'&sortcat='+b ;
	}
	if (i==4)
	{
		document.location.href ='promotional_offer_list_new.asp?brandname='+brandname+'&sortcat='+b ;
	}

	if (i==2)
	{
		var c,d
		c=document.homevalue.sc.value;
		d=document.homevalue.catname.value;
		document.location.href ='diamond_subcategory_new.asp?cat='+a+'&sortcat='+b+'&sc='+c+'&catname='+d;
	}
	if (i==3)
	{
		var c,d
		c=document.homevalue.gemstone.value;
		d=document.homevalue.price.value;
		document.location.href ='advancesearch_results_new.asp?category='+a+'&sortcat='+b+'&gemstone='+c+'&price='+d;
	}

}
function sortgo3k(i)
{
	var a,b
	a = document.homevalue.cat.value;
	b = eval('document.homevalue.sort_type.options[document.homevalue.sort_type.selectedIndex].value');

	if (i==1)
	{
		document.location.href ='Promotion_page_3k_new.asp?sortcat='+b ;
	}

	if (i==2)
	{
		var c,d
		c=document.homevalue.sc.value;
		d=document.homevalue.catname.value;
		document.location.href ='Promotion_page_3k_new.asp?cat='+a+'&sortcat='+b+'&sc='+c+'&catname='+d;
	}
	if (i==3)
	{
		var c,d
		c=document.homevalue.gemstone.value;
		d=document.homevalue.price.value;
		document.location.href ='Promotion_page_3k_new.asp?category='+a+'&sortcat='+b+'&gemstone='+c+'&price='+d;
	}
}

function sortgo5k(i)
{
	var a,b
	a = document.homevalue.cat.value;
	b = eval('document.homevalue.sort_type.options[document.homevalue.sort_type.selectedIndex].value');

	if (i==1)
	{
		document.location.href ='Promotion_page_5k_new.asp?sortcat='+b;
	}

	if (i==2)
	{
		var c,d
		c=document.homevalue.sc.value;
		d=document.homevalue.catname.value;
		document.location.href ='Promotion_page_content_5000_new.asp?cat='+a+'&sortcat='+b+'&sc='+c+'&catname='+d;
	}
	if (i==3)
	{
		var c,d
		c=document.homevalue.gemstone.value;
		d=document.homevalue.price.value;
		document.location.href ='Promotion_page_content_5000_new.asp?category='+a+'&sortcat='+b+'&gemstone='+c+'&price='+d;
	}
}

function sortgo10k(i)
{
	var a,b
	a = document.homevalue.cat.value;
	b = eval('document.homevalue.sort_type.options[document.homevalue.sort_type.selectedIndex].value');

	if (i==1)
	{
		document.location.href ='Promotion_page_10k_new.asp?sortcat='+b ;
	}

	if (i==2)
	{
		var c,d
		c=document.homevalue.sc.value;
		d=document.homevalue.catname.value;
		document.location.href ='Promotion_page_10k_new.asp?cat='+a+'&sortcat='+b+'&sc='+c+'&catname='+d;
	}
	if (i==3)
	{
		var c,d
		c=document.homevalue.gemstone.value;
		d=document.homevalue.price.value;
		document.location.href ='Promotion_page_10k_new.asp?category='+a+'&sortcat='+b+'&gemstone='+c+'&price='+d;
	}
}


function zoomItindexpopup(i)
{
	file=i;
	window.open(file,"new",'height=160,width=318,left=410,top=385,resizable=no,scrollbars=no');
}

function chkqty(a)
{
var stringValue = String(a);

if (Trim(eval('document.homevalue.homeqty'+stringValue+'.value'))=='' )
	{
		eval('document.homevalue.homeqty'+stringValue+'.value=1');
	}

if ( (eval('document.homevalue.homeqty'+stringValue+'.value').substr(0,1))=='-' || (eval('document.homevalue.homeqty'+stringValue+'.value').substr(0,1))=='+' ) 
	{
	eval('document.homevalue.homeqty'+stringValue+'.value='+eval('document.homevalue.homeqty'+stringValue+'.value').substr(1,1));
	}


if (isNaN(eval('document.homevalue.homeqty'+stringValue+'.value')))
	{
		alert ('Please enter Numeric value');
		eval('document.homevalue.homeqty'+stringValue+'.value=1');
	}
else
	{
	if (parseInt(eval('document.homevalue.homeqty'+stringValue+'.value')) > parseInt (eval('document.homevalue.unitinhand'+stringValue+'.value')))
		{
			alert('Unit in hand-: '+eval('document.homevalue.unitinhand'+stringValue+'.value'))	
			eval('document.homevalue.homeqty'+stringValue+'.value=1');
		}
	}
}

function chkqty_loosdiamond(a)
{
var stringValue = String(a);

if (Trim(eval('document.LooseDiamond.homeqty'+stringValue+'.value'))=='' || eval('document.LooseDiamond.homeqty'+stringValue+'.value')==0)
	{
		eval('document.LooseDiamond.homeqty'+stringValue+'.value=1');
	}

if ( (eval('document.LooseDiamond.homeqty'+stringValue+'.value').substr(0,1))=='-' || (eval('document.LooseDiamond.homeqty'+stringValue+'.value').substr(0,1))=='+' ) 
	{
	eval('document.LooseDiamond.homeqty'+stringValue+'.value='+eval('document.LooseDiamond.homeqty'+stringValue+'.value').substr(1,1));
	}


if (isNaN(eval('document.LooseDiamond.homeqty'+stringValue+'.value')))
	{
		alert ('Please enter Numeric value');
		eval('document.LooseDiamond.homeqty'+stringValue+'.value=1');
	}
else
	{
	if (parseInt(eval('document.LooseDiamond.homeqty'+stringValue+'.value')) > parseInt (eval('document.LooseDiamond.unitinhand'+stringValue+'.value')))
		{
			alert('Unit in hand-: '+eval('document.LooseDiamond.unitinhand'+stringValue+'.value'))	
			eval('document.LooseDiamond.homeqty'+stringValue+'.value=1');
		}
	}
}


function shoppingcart_chkringsize()
{
alert("Please click update button to update Ring size");
}


function Trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}


function cartdetail_chkqty(a)
{

var stringValue = String(a);

if (eval('document.frm.qty_'+stringValue+'.value') < 0 || Trim(eval('document.frm.qty_'+stringValue+'.value'))=='')
	 {
		eval('document.frm.qty_'+stringValue+'.value=1');
   	 }

if ( (eval('document.frm.qty_'+stringValue+'.value').substr(0,1))=='-' || (eval('document.frm.qty_'+stringValue+'.value').substr(0,1))=='+' ) 
	{
	eval('document.frm.qty_'+stringValue+'.value='+eval('document.frm.qty_'+stringValue+'.value').substr(1,1));
	}

if (isNaN(eval('document.frm.qty_'+stringValue+'.value')))
	{
		alert ('Please enter Numeric value');
		eval('document.frm.qty_'+stringValue+'.value=1');
	}
else
	{
	if (parseInt(eval('document.frm.qty_'+stringValue+'.value')) > parseInt (eval('document.frm.unitinhand'+stringValue+'.value') - eval('document.frm.unitinorder'+stringValue+'.value')) )
		{
			var aa;
			aa = parseInt(eval('document.frm.unitinhand'+stringValue+'.value')-eval('document.frm.unitinorder'+stringValue+'.value'));
			alert('Unit in hand-: '+ aa );	
			eval('document.frm.qty_'+stringValue+'.value='+ parseInt(eval('document.frm.unitinhand'+stringValue+'.value')-eval('document.frm.unitinorder'+stringValue+'.value')));
		}
	if (parseInt (eval('document.frm.qty_'+stringValue+'.value'))==0)
		{
			eval('document.frm.qty_'+stringValue+'.value=1');
		}

	}
alert("Please Click on Update button to Update Quantity");
}


//ring size checking
function cartdetail_chksize(a)
{

	var stringValue = String(a);
	
	if (eval('document.frm.size_'+stringValue+'.value') <= 0 || Trim(eval('document.frm.size_'+stringValue+'.value'))=='')
		 {
			eval('document.frm.size_'+stringValue+'.value=7');
		 }
	
	if ( (eval('document.frm.size_'+stringValue+'.value').substr(0,1))=='-' || (eval('document.frm.size_'+stringValue+'.value').substr(0,1))=='+' ) 
		{
		eval('document.frm.size_'+stringValue+'.value='+eval('document.frm.size_'+stringValue+'.value').substr(1,1));
		}

	if (isNaN(eval('document.frm.size_'+stringValue+'.value')))
		{
			alert ('Please enter Numeric value');
			eval('document.frm.size_'+stringValue+'.value=7');
		}
	else
		{
			if (parseInt (eval('document.frm.size_'+stringValue+'.value'))>100)
				{
					alert ('Please enter size less than 100');
					eval('document.frm.size_'+stringValue+'.value=7');
				}
		}
alert("Please Click on Update button to Update Ring Size");
}




function func_addtocart(a)
{
	var fqty;
	var cat;
	var price;
	fqty = eval('document.homevalue.homeqty'+a+'.value');
	if (fqty < 0 || Trim(fqty)=='')
	 {
		eval('document.homevalue.homeqty'+a+'.value=1');
		fqty=1;
   	 }

	if (Trim(eval('document.homevalue.homeqty'+a+'.value'))=='' )
	{
		eval('document.homevalue.homeqty'+a+'.value=1');
	}

	if ( (eval('document.homevalue.homeqty'+a+'.value').substr(0,1))=='-' || (eval('document.homevalue.homeqty'+a+'.value').substr(0,1))=='+' ) 
	{
		eval('document.homevalue.homeqty'+a+'.value='+eval('document.homevalue.homeqty'+a+'.value').substr(1,1));
	}
	if (isNaN(eval('document.homevalue.homeqty'+a+'.value')))
	{
		alert ('Please enter Numeric value');
		eval('document.homevalue.homeqty'+a+'.value=1');
	}

	else
	{
		if (parseInt(eval('document.homevalue.homeqty'+a+'.value')) > parseInt (eval('document.homevalue.unitinhand'+a+'.value') - eval('document.homevalue.unitinorder'+a+'.value')) )
		{
			alert('Unit in hand-: '+ (eval('document.homevalue.unitinhand'+a+'.value')-eval('document.homevalue.unitinorder'+a+'.value')))	
			return false;
			eval('document.homevalue.homeqty'+a+'.value=1');
		}
	}

	cat  = eval('document.homevalue.cat'+a+'.value');
	price1 = eval('document.homevalue.price'+a+'.value');
	price2 = eval('document.homevalue.promotionprice'+a+'.value');
	if ( parseInt(price2)!=0 )
		{
			price=price2;
		}
	else
		{
			price=price1;		
		}
	fqty = eval('document.homevalue.homeqty'+a+'.value');
	document.location.href ='ItemToCart_new.asp?pid='+a+'&cat='+cat+'&price='+price+'&homeqty'+a+'='+fqty ;
}

function func_buynow(a)
{
	var fqty;
	var cat;
	var price;			
	fqty = eval('document.homevalue.homeqty'+a+'.value');
	if (fqty < 0 || Trim(fqty)=='')
	 {
		eval('document.homevalue.homeqty'+a+'.value=1');
		fqty=1;

   	 }
	cat  = eval('document.homevalue.cat.value');
	price = eval('document.homevalue.price'+a+'.value');
	document.location.href ='buynow_new.asp?pid='+a+'&cat='+cat+'&price='+price+'&homeqty'+a+'='+fqty ;
}



function func_modepay()
{
	select1 = eval('document.paymentmode.select1.options[document.paymentmode.select1.selectedIndex].value');
	document.paymentmode.select1.value = eval('document.paymentmode.select1.options[document.paymentmode.select1.selectedIndex].value');
}

function func_modepayselect()
{
	select1 = eval('document.paymentmode.select1.options[document.paymentmode.select1.selectedIndex].value');
	if (select1!=0)
	{
		document.paymentmode.select1.value = eval('document.paymentmode.select1.options[document.paymentmode.select1.selectedIndex].value');
		document.location.href ='bankoffpayinfo_b_new.asp?select='+select1 ;
	}
	else
	{
	alert('Select Payment Option from the list');
	document.paymentmode.select1.focus();
	return false;	
	}

}


function cartdetail_chkselect(a)
{
	var stringValue = String(a);
	if (eval('document.frm.qtyselect_'+stringValue+'.checked') == true )
		 {
			 eval('document.frm.select'+a+'.value=1');
			 alert ('Item selected, Click Update Button');
//			 alert(eval('document.frm.select'+a+'.value'));

	   	 }
	else
		{
			 eval('document.frm.select'+a+'.value=0');
			 alert ('Item Not selected, Click Update Button');
// 			 alert(eval('document.frm.select'+a+'.value'));
		}
}


function func_Diamond_addtocart(a)
{
	var fqty;
	var cat;
	var price;
	fqty = eval('document.LooseDiamond.homeqty'+a+'.value');
	if (fqty < 0 || Trim(fqty)=='')
	 {
		eval('document.LooseDiamond.homeqty'+a+'.value=1');
		fqty=1;
   	 }
	
	if (Trim(eval('document.LooseDiamond.homeqty'+a+'.value'))=='' )
	{
		eval('document.LooseDiamond.homeqty'+a+'.value=1');
	}
	
	if ( (eval('document.LooseDiamond.homeqty'+a+'.value').substr(0,1))=='-' || (eval('document.LooseDiamond.homeqty'+a+'.value').substr(0,1))=='+' ) 
	{
		eval('document.LooseDiamond.homeqty'+a+'.value='+eval('document.LooseDiamond.homeqty'+a+'.value').substr(1,1));
	}
	
	if (isNaN(eval('document.LooseDiamond.homeqty'+a+'.value')))
	{
		alert ('Please enter Numeric value');
		eval('document.LooseDiamond.homeqty'+a+'.value=1');
	}
	else
	{
		if (parseInt(eval('document.LooseDiamond.homeqty'+a+'.value')) > parseInt (eval('document.LooseDiamond.unitinhand'+a+'.value') - eval('document.LooseDiamond.unitinorder'+a+'.value')) )
		{
			alert('Unit in hand-: '+ (eval('document.LooseDiamond.unitinhand'+a+'.value')- eval('document.LooseDiamond.unitinorder'+a+'.value')) )	
			return false;
			eval('document.LooseDiamond.homeqty'+a+'.value=1');
		}
	}

	cat  = eval('document.LooseDiamond.cat'+a+'.value');
	price1 = eval('document.LooseDiamond.price'+a+'.value');
	price2 = eval('document.LooseDiamond.promotionprice'+a+'.value');
	if ( parseInt(price2)!=0 )
		{
			price=price2;
		}
	else
		{
			price=price1;		
		}
	fqty = eval('document.LooseDiamond.homeqty'+a+'.value');
	document.location.href ='Diamond_ItemToCart_new.asp?pid='+a+'&cat='+cat+'&price='+price+'&homeqty'+a+'='+fqty ;
}





function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function

//-->


var xmlHttp

function ValidateDiscKey(str)
{
if (str.length==0)
  { 
  document.getElementById("errmsg").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="validateDisc.asp";
url=url+"?q="+str;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 

if (xmlHttp.readyState != 4)
{ 
document.getElementById("logo").innerHTML= "<img src='images/loading.gif'>"
}
if (xmlHttp.readyState==4)
{ 

if(xmlHttp.responseText == "Valid"){
	
	return true
}

else{
	
	document.getElementById("logo").innerHTML= ""
document.getElementById("errmsg").innerHTML="<script>alert('Invalid Voucher Number')</script>"+document.getElementById("errmsg").innerHTML + xmlHttp.responseText;
return false
}
}
}

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;
}