﻿var chk_keycode="";function checkmail(str){var at="@"
var dot="."
var temp;var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
var invalidchar=" \"([{}])!#$%^&*';:,/\\?|+`~<>=~"
if(str.indexOf(at)==-1){alert("Please Enter a valid Email ID.")
return false}
if(str.indexOf(at)==-1||str.indexOf(at)==0||str.indexOf(at)==lstr-1){alert("Please Enter a valid Email ID.")
return false}
if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==lstr-1){alert("Please Enter a valid Email ID.")
return false}
if(str.indexOf(at,(lat+1))!=-1){alert("Please Enter a valid Email ID.")
return false}
if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){alert("Please Enter a valid Email ID.")
return false}
if(str.indexOf(dot,(lat+2))==-1){alert("Please Enter a valid Email ID.")
return false}
for(i=0;i<(invalidchar.length-1);i++){temp=invalidchar.substring(i,i+1);if(str.indexOf(temp)!=-1){alert("Please Enter a valid Email ID.")
return false}}
return true;}
function checkjunkchar(str,fieldname){var invalidchar=" \"([{}])!#$%^&*';:,/\\?|+-`~<>=~@.0123456789"
for(i=0;i<(invalidchar.length-1);i++){temp=invalidchar.substring(i,i+1);if(str.indexOf(temp)!=-1)
{alert("Special characters/spaces are not allowed in "+fieldname+".");return false}}
return true;}
function validateform(strValidateStr,command,fieldname)
{var strError="";var epos=command.search("=");var newcommand="";var cmdvalue="";if(epos>=0){newcommand=command.substring(0,epos);cmdvalue=command.substr(epos+1);}
else{newcommand=command;}
switch(newcommand){case"req":case"required":{if((strValidateStr.length)==0){strError=fieldname+" is a  Required Field";alert(strError);strError="";return false;}
break;}
case"maxlength":case"max":{if(strValidateStr.length>cmdvalue){strError=fieldname+" has more than allowed ";strError=strError+"["+cmdvalue+"]";strError=strError+" characters ";strError=strError+"\n[Current length = "+strValidateStr.length+" ]"
alert(strError);strError="";return false;}
break;}
case"minlength":case"min":{if(strValidateStr.length<cmdvalue){strError=fieldname+" : has less than allowed minimum characters  ";alert(strError+"\n[Current length = "+strValidateStr.length+" ]");return false;}
break;}
case"alnum":case"alphanumeric":{var charpos=strValidateStr.search("[^A-Za-z0-9-/,.  ]");if(strValidateStr.length>0&&charpos>=0){strError=fieldname+" : allows Only alpha-numeric characters  ";alert(strError+"\n [Error character position "+eval(charpos+1)+"]");strError="";return false;}
break;}
case"num":case"numeric":{var charpos=strValidateStr.search("[^0-9]");if(strValidateStr.length>0&&charpos>=0){strError=fieldname+" : allows Only numbers ";alert(strError+"\n [Error character position "+eval(charpos+1)+"]");strError="";return false;}
break;}
case"alphabetic":case"alpha":{var charpos=strValidateStr.search("[^A-Za-z ]");if(strValidateStr.length>0&&charpos>=0){strError=fieldname+" : allows Only alphabetic characters  ";alert(strError+"\n [Error character position "+eval(charpos+1)+"]");strError="";return false;}
break;}
case"email":{if(!checkmail(strValidateStr)){return false;}
break;}
case"lt":case"lessthan":{if(isNaN(strValidateStr)){alert(fieldname+" : Should be a number ");return false;}
if((strValidateStr)>=eval(cmdvalue)){strError=fieldname+" : value should be less than "+cmdvalue;alert(strError);strError="";return false;}
break;}
case"gt":case"greaterthan":{if(isNaN(strValidateStr)){alert(objValue.name+" : Should be a number ");return false;}
if(strValidateStr<=eval(cmdvalue)){strError=fieldname+" : value should be greater than "+cmdvalue;alert(strError);strError="";return false;}
break;}
case"regexp":{if(!strValidateStr.match(cmdvalue)){strError=fieldname+" : Invalid characters found ";alert(strError);return false;}
break;}
case"UT":{if(strValidateStr.search("UT")<0&&strValidateStr.search("ut")<0&&strValidateStr.search("uT")<0&&strValidateStr.search("Ut")<0){strError=fieldname+" : must start with UT";alert(strError);return false;}
break;}}
return true;}
function validateData(strValidateStr,command,fieldname)
{var newcommand=command.split(",");for(var i=0;i<newcommand.length;i++){var val=validateform(strValidateStr,newcommand[i],fieldname)
if(val==false){return val;}}
return val;}
function validatemsg(str)
{var comm
comm=str
if(comm!="")
{return true;}
else
{alert("Message is a  Required Field");return false;}}
function submitMessage()
{var val="false";var str
str=document.getElementById('nametxt').value;val=validateData(str,'required,max=30,alpha','Name')
if(val==true)
{str=document.getElementById('emailtxt').value;val=validateData(str,'required,max=50,email','Email ID')
if(val==true)
{str=document.getElementById('msg').value;val=validatemsg(str);if(val==true)
{centerWindowX('http://www.utsavfashion.com/store/submit.aspx?custemail='+document.getElementById('emailtxt').value+'&custname='+document.getElementById('nametxt').value+'&mode=queryhtml'+'&comments='+document.getElementById('msg').value);document.getElementById('msg').value="";document.getElementById('emailtxt').value="";document.getElementById('nametxt').value="";}
else
{document.getElementById('msg').focus();}}
else
{document.getElementById('emailtxt').focus();}}
else
{document.getElementById('nametxt').focus();}}
function changebuttoncolor(e,mouse)
{var color="";if(mouse=="OVER")
{color="#C13100";}
else
{color="#CC6600";}
var el=window.event?event.srcElement:e.target
if(el.tagName=="INPUT"&&el.type=="submit"||el.tagName=="INPUT"&&el.type=="button")
el.style.backgroundColor=color}
function changebuttoncolor(e,mouse)
{var color="";if(mouse=="OVER")
{color="#C13100";}
else
{color="#CC6600";}
var el=window.event?event.srcElement:e.target
if(el.tagName=="INPUT"&&el.type=="submit"||el.tagName=="INPUT"&&el.type=="button")
el.style.backgroundColor=color}
function verifysearchkeyword()
{var keyword="";keyword=document.getElementById("q").value;if(keyword==""||keyword=="Sarees, Salwar Kameez, etc.")
{alert("Please enter keyword for search!");}
else
{document.search.submit();}}
function verifysearchkeywords(pageloc)
{var keyword="";keyword=document.search.q.value;if(keyword==""||keyword=="Sarees, Salwar Kameez, etc.")
{alert("Please enter keyword for search!");return false;}
else
{if(pageloc=='search'){window.location.href='http://www.utsavfashion.com/store/search.aspx?q='+keyword;return false;}
else if(pageloc=='adsearch'){window.location.href='http://www.utsavfashion.com/store/textsearch.aspx?cx=006683068870264856926:db-jn-vpts4&cof=FORID:11&q='+keyword;}
else if(pageloc=='tag'){window.location.href='http://www.utsavfashion.com/store/tagging.aspx?t='+keyword;}
return true;}}
function make_blanknmail(dis,q)
{if(dis=="hide")
{if(document.getElementById(q).value=="Enter your Email id")
{document.getElementById(q).value="";}}
else if(dis=="show")
{if(document.getElementById(q).value=="")
{document.getElementById(q).value="Enter your Email id";}}}
function make_blank(dis,q)
{if(dis=="hide")
{if(document.getElementById(q).value=="Sarees, Salwar Kameez, etc.")
{document.getElementById(q).value="";document.search.q.style.color="#3E3939";}}
else if(dis=="show")
{if(document.getElementById(q).value=="")
{document.search.q.style.color="#cccccc";document.getElementById(q).value="Sarees, Salwar Kameez, etc.";}}}
function MM_openBrWindow(theURL,winName,features){window.open(theURL,winName,features);}
function centerWindowX(fname){if(document.all)
var xMax=screen.width,yMax=screen.height;else
if(document.layers)
var xMax=window.outerWidth,yMax=window.outerHeight;else
var xMax=640,yMax=480;var xOffset=(xMax-490)/2,yOffset=(yMax-190)/2;MM_openBrWindow(fname,'info','width=400,height=150,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');}
function MM_openBrWindow(theURL,winName,features){window.open(theURL,winName,features);}
function centerWindowX(fname){if(document.all)
var xMax=screen.width,yMax=screen.height;else
if(document.layers)
var xMax=window.outerWidth,yMax=window.outerHeight;else
var xMax=640,yMax=480;var xOffset=(xMax-490)/2,yOffset=(yMax-190)/2;MM_openBrWindow(fname,'info','width=400,height=150,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');}
function submitLetterindexaspx_n(opt){if(opt=='F'){var giftcode="";giftcode=document.surveyfeedback.surveycode.value;if(document.surveyfeedback.Email.value=="")
{alert("Please Enter Email ID");document.surveyfeedback.Email.focus();}
else if(checkmail(document.surveyfeedback.Email.value)){val=document.surveyfeedback.Email.value
if(opt=='F')
{centerWindowX('http://www.utsavfashion.com/store/submit.aspx?Email='+val+'&mode=surveyfeedback&giftcode='+giftcode);}
document.surveyfeedback.Email.value=''}}
else
{if(document.newsletter.Email.value=="")
{alert("Please Enter Email ID");document.newsletter.Email.focus();}
else if(checkmail(document.newsletter.Email.value)){val=document.newsletter.Email.value
if(opt=='Y')
{centerWindowX('http://www.utsavfashion.com/store/submit.aspx?Email='+val+'&mode=letter');}
else if(opt=='N')
{centerWindowX('http://www.utsavfashion.com/store/submit.aspx?Email='+val+'&mode=letter');}
document.newsletter.Email.value=''}}}
var giftaddsban;function loadadgiftadd(pagepart){if(window.XMLHttpRequest){giftaddsban=new XMLHttpRequest();}
else{giftaddsban=new ActiveXObject("Microsoft.XMLHTTP");}
giftaddsban.onreadystatechange=function(){if(giftaddsban.readyState==4&&giftaddsban.status==200){document.getElementById("giftbannerhead").innerHTML=giftaddsban.responseText;}}
var datime;datime=new Date().getSeconds();giftaddsban.open("GET","http://www.utsavfashion.com/include/addrotater2.aspx?p="+pagepart+"&d="+datime,true);giftaddsban.send();}
function DisAllowApostrophe(e,id)
{var val1=DisAllowSpaceAsFirstChar(e,id);if(val1==false)return false;var browserchk=window.event?e.keyCode:e.which;if(browserchk==39)return false;}
function DisAllowSpaceAsFirstChar(e,id)
{var browserchk=window.event?e.keyCode:e.which;var chkfirstchar=document.getElementById(id).value;if(chkfirstchar.length<1)
{if(browserchk==32)
return false;}}
function PostalCodeFormat(e,id)
{var val1=DisAllowApostrophe(e,id);var val2=DisAllowSpaceAsFirstChar(e,id);if(val1==false)return false;if(val2==false)return false;var browserchk=window.event?e.keyCode:e.which;if((browserchk>=48&&browserchk<=57)||(browserchk>=65&&browserchk<=90)||(browserchk>=97&&browserchk<=122)||browserchk==32)
{return true;}
if(browserchk>=33&&browserchk<=255)
{return false;}}
function contactqueryb2b()
{
var valnew
var why = true;

if (document.form1.message.value=="")
{
alert("Message Can Not Blank")
document.form1.message.focus();
return false;

}
else if (document.form1.fullname.value=="")
{
alert("Contact Person Name Can Not Blank")
document.form1.fullname.focus();
return false;
}
else if (document.form1.qemail.value=="")
{
alert("E-Mail Address Can Not Blank")
document.form1.qemail.focus();
return false;
}
else if (document.form1.address.value=="")
{
alert("Address Can Not Blank")
document.form1.address.focus();
return false;
}

else if (document.form1.phone.value=="")
{
alert("Phone Number Can Not Blank")
document.form1.phone.focus();
return false;
}
else if (document.form1.Countryname.selectedIndex=="")
{
alert("Country Name Can Not Blank")
document.form1.Countryname.focus();
return false;
}

else if (document.form1.qemail.value != "")
    {	
    	why = checkmail(document.form1.qemail.value );
    		if (why != true)
    		{
    		document.form1.qemail.focus();
    		return false;
    		}  
    	
	 }
 
 valnew=document.form1.message.value;
 valnew=valnew+'.;'+document.form1.companyname.value;
 valnew=valnew+'.;'+document.form1.fullname.value;
 valnew=valnew+'.;'+document.form1.qemail.value;
 valnew=valnew+'.;'+document.form1.phone.value;
 valnew=valnew+'.;'+document.form1.address.value;
 valnew=valnew+'.;'+document.form1.city.value;
 valnew=valnew+'.;'+document.form1.Countryname.value;
  
 centerWindowX('http://www.utsavfashion.com/store/submit.aspx?val='+valnew+'&mode=contactqueryb2b'); 

 document.form1.reset();
 

}
function DisAllowAlphabets()
  {     
var isNS4 = (navigator.appName=="Netscape")?1:0;
if(!isNS4){
	if(event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;}
else{if((event.which < 48 || event.which > 57) && !(event.which == 8)){ return false;}}
}


function DisAllowNumbers(){
      if ((window.event.keyCode >= 48 && window.event.keyCode <= 57) || window.event.keyCode==39 || window.event.keyCode==34 || window.event.keyCode==60 || window.event.keyCode==62 || window.event.keyCode==63 || window.event.keyCode==124 || window.event.keyCode==45 || window.event.keyCode==43 || window.event.keyCode==58 || window.event.keyCode==40 || window.event.keyCode==41) {
           window.event.returnValue=false; }
        else if(window.event.keyCode == 32){
          window.event.returnValue=true;}
}

function showmain_menu(id)
{ 
document.getElementById('More').style.display=""; 
document.getElementById('More')
}

function hidemain_menu(id)
{ 
document.getElementById('More').style.display="none";
document.getElementById('More')
}
function cstimedivshow()
{
document.getElementById('cstimediv').style.display=""; 
}

function cstimedivhide()
{
document.getElementById('cstimediv').style.display='none'; 
}
var cstime;

function showcstimediv() {

	cstime = checkajax();
	
	if (cstime == null) {
		alert("Your browser does not support AJAX!");
		return;
	}
	var url;

	url = "customer.htm" ;

	cstime.onreadystatechange = fetchCStimediv;
	cstime.open("GET", url, true);
	cstime.send(null);
}
function fetchCStimediv() {
	if (cstime.readyState == 4) {
	    document.getElementById('cstimediv').style.display=""; 
		document.getElementById("cstimediv").innerHTML = cstime.responseText;
	}

	}
function checkajax() {
	var check = null;
	try {
		// Firefox, Opera 8.0+, Safari
		check = new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			check = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			check = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return check;

}



