
function hide_forgot_password()
{setTimeout('hide_forgot()',3000);}
function hide_forgot()
{Effect.SlideUp('dd1');return false;}
function clear_forgot_feild()
{document.getElementById('forgot_msg').innerHTML="";}
function checkforgotpass(theForm)
{arr=new Array();arr["theControl"]="vchEmail";arr["theMessage"]="Email Address";arr["theempty"]="Y";arr["theEmail"]="Y";if(!validateForm(theForm,arr,1))
{return false;}
else
{xajax_forgot_password(theForm.vchEmail.value);return false;}
return false;}
function my_Page()
{window.location.href=hostURL+"welcome.php";}
function myRight(str,n){if(n<=0)
return"";else if(n>String(str).length)
return str;else{var iLen=String(str).length;return String(str).substring(iLen,iLen-n);}}
function myChangeStatus(theForm,id)
{var stat=document.getElementById('enumStatus'+id).value;if(stat=='A')
{rtn=confirm("Are you sure you want to deactivate this record?");}
else if(stat=='D')
{rtn=confirm("Are you sure you want to activate this record?");}
if(rtn)
{var status=eval('theForm.enumStatus'+id).value;xajax_update_status(id,status);}}
function myChangeStatus_discount(theForm,id,discType)
{var stat=document.getElementById('enumStatus'+discType+id).value;if(stat=='A')
{rtn=confirm("Are you sure you want to deactivate this record?");}
else if(stat=='D')
{rtn=confirm("Are you sure you want to activate this record?");}
if(rtn)
{var status=eval('theForm.enumStatus'+discType+id).value;xajax_update_status_discount(id,status,discType);}}
function sendNewsLetter(id)
{if(confirm('Are you sure you want to send this newsletter?'))
xajax_sendnewsletter(id);}
function myUpdateStatus(theForm,id,param)
{if(param=="currency")
{var stat=document.getElementById('enumStatus'+id).value;}
if(param=="country")
{var stat=document.getElementById('enumStatues'+id).value;}
if(stat=='A')
{rtn=confirm("Are you sure you want to deactivate this record?");}
else if(stat=='D')
{rtn=confirm("Are you sure you want to activate this record?");}
if(rtn)
{if(param=="currency")
{var status=eval('theForm.enumStatus'+id).value;}
if(param=="country")
{var status=eval('theForm.enumStatues'+id).value;}
xajax_update_status(id,status,param);}}
function delete_row(cardid,defCheck,totalCards)
{if(totalCards==1)
{if(defCheck=='Yes')
{if(confirm('Are you sure you want to delete the credit card, you would need to \n re-enter the credit card details for future purchase?'))
xajax_deleteRow(cardid);}}
else if(totalCards>1)
{if(defCheck=='Yes')
{alert('You are deleting your default credit card, please select your next default \n credit card for future transactions.');}
else
{if(confirm('Are you sure you want to delete the credit card?'))
xajax_deleteRow(cardid);}}}
function delete_all_row(ids)
{xajax_deleteAllRow(ids);}
Array.prototype.exists=function(x){for(var i=0;i<this.length;i++){if(this[i].value==x)return true;}
return false;}
function clear_cal_date(field_id)
{document.getElementById(field_id).value="";document.getElementById('disp_cal_'+field_id).innerHTML='&nbsp;&nbsp;';}
function byteCounter(field,countfield,maxlimit,setDiv){if(field.value.length>maxlimit)
{field.value=field.value.substring(0,maxlimit);document.getElementById(setDiv).innerHTML=field.value.length+"/"+maxlimit;}
else
{countfield.value=maxlimit-field.value.length;document.getElementById(setDiv).innerHTML=field.value.length+"/"+maxlimit;}}
function get_element_text(element_id)
{var text="";var elem=document.getElementById(element_id);if(elem.textContent){text=trim(elem.textContent);}else if(elem.innerText){text=trim(elem.innerText);}
return text;}
function MM_openBrWindow(theURL,winName,features)
{window.open(theURL,winName,features);}
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_findObj(n,d){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(){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];}}
function MM_swapImgRestore(){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 swap_text(txtCaption){if(window.document.getElementById)
{window.document.getElementById("txtCaption").innerHTML=txtCaption;}
if(window.document.layers)
{window.document.layers["txtCaption"].innerHTML=txtCaption;}
if(window.document.all)
{window.document.all["txtCaption"].innerHTML=txtCaption;}}
function isDefined(variable,type_evt)
{try
{if(type_evt==1)
{if(variable==null)
{return false;}
if("undefined"==typeof(variable))
{return false;}
return true;}
else
return(typeof(window[variable])=="undefined")?false:true;}
catch(e)
{}}
function strRepeat(cnt)
{var retStr="";for(i=0;i<cnt;i++)
retStr=retStr+",";return retStr;}
function validateForm(myForm,cArray,cnt)
{var i=0;var values="theControl,theMessage,theNumeric,theEmail,theURL,theConfirmPassword,thebadstuff,theinteger,thepercent,thesize,thedecimal,theimage,theempty,themin,themax,thecheckboxlength,thephoneno";var leftSide=new Array();var rightVals=new Array();leftSide=values.split(",");var strRepeats=strRepeat(cnt-1);for(i=0;i<leftSide.length;i++){if(cArray[leftSide[i]]){rightVals[i]=(cArray[leftSide[i]]);}else{rightVals[i]=strRepeats;}
leftSide[i]=rightVals[i];}
if(!theValidator(myForm,leftSide[0],leftSide[1],leftSide[2],leftSide[3],leftSide[4],leftSide[5],leftSide[6],leftSide[7],leftSide[8],leftSide[9],leftSide[10],leftSide[11],leftSide[12],leftSide[13],leftSide[14],leftSide[15],leftSide[16]))
return false;return true;}
function validate_FckEditor(instanceName)
{var oEditor=FCKeditorAPI.GetInstance(instanceName);var str=oEditor.EditorDocument.body.innerHTML;str=str.replace("&nbsp;","");str=str.replace("<BR>","");str=str.replace("<BR/>","");str=str.replace("<P>","");str=str.replace("</P>","");str=str.replace("<br>","");str=str.replace("<br/>","");str=str.replace("<p>","");str=str.replace("</p>","");if(str=="")
return false;else
return true;}
function addRowToTable(theForm)
{var tbl=document.getElementById('tblDynamic');var lastRow=tbl.rows.length;if(lastRow<=5)
{if(document.getElementById('no-child'))
{var ind=document.getElementById('no-child').rowIndex;tbl.deleteRow(ind);lastRow=tbl.rows.length;}
theForm.tempCounter.value=parseInt(theForm.tempCounter.value,10)+1;var td0=theForm.mm.value+'/'+theForm.dd.value+'/'+theForm.yy.value;var dob=theForm.yy.value+'-'+theForm.mm.value+'-'+theForm.dd.value;if(theForm.enumGender[0].checked){var td1='Boy';}
else{var td1='Girl';}
var td2=document.createElement('img');td2.setAttribute('src','images/delete-new.gif');td2.setAttribute('title','Delete');td2.setAttribute('alt','Delete');td2.setAttribute('border','0');var hidChild=document.createElement('input');hidChild.setAttribute('type','hidden');hidChild.setAttribute('name','child[]');if(td1=='Boy')hidChild.setAttribute('value','B'+','+dob);else hidChild.setAttribute('value','G'+','+dob);var row=tbl.insertRow(lastRow);row.setAttribute('id','child-'+theForm.tempCounter.value);td2.onclick=function(){delRowTable(row)}
var cell0=row.insertCell(0);var textNode0=document.createTextNode(td0);cell0.appendChild(textNode0);cell0.appendChild(hidChild);var cell1=row.insertCell(1);var textNode1=document.createTextNode(td1);cell1.appendChild(textNode1);var cell2=row.insertCell(2);cell2.appendChild(td2);}
else
alert('Maximum limit is 5.');}
function delRowTable(tr)
{if(document.getElementById('child-'+tr))
{var tbl=document.getElementById('tblDynamic');var ind=document.getElementById('child-'+tr).rowIndex;tbl.deleteRow(ind);}
else
{tr.parentNode.removeChild(tr);}}
function addRowToTable_associate(theForm)
{var tbl=document.getElementById('tblDynamic');var lastRow=tbl.rows.length;theForm.tempCounter.value=parseInt(theForm.tempCounter.value)+1;if(theForm.cat_level2.value!="")
{var x=theForm.cat_level1;var y=theForm.cat_level2;var cat_id=theForm.cat_level2.value;var parent_id=theForm.cat_level1.value;}
else
{if(theForm.cat_level2.length>=0)
{alert('Please select Sub-Category.');theForm.cat_level2.focus();return false;}
var x=theForm.cat_level1;var y=theForm.cat_level2;var cat_id=theForm.cat_level2.value;var parent_id=theForm.cat_level1.value;}
cats=Form.getInputs(theForm,'hidden','cats[]');var my_cats=$A(cats);var is_exists;is_exists=(my_cats.exists(cat_id));if(!is_exists)
{var parent_name=x.options[x.selectedIndex].text;var cat_name=y.options[y.selectedIndex].text;var td0=''+parent_name;var td1=''+cat_name;var td2=document.createElement('img');td2.setAttribute('src','images/delete1.gif');td2.setAttribute('title','Delete');td2.setAttribute('alt','Delete');td2.setAttribute('border','0');td2.setAttribute('class','setcursor');var hidCat=document.createElement('input');hidCat.setAttribute('type','hidden');hidCat.setAttribute('name','cats[]');hidCat.setAttribute('value',cat_id);var row=tbl.insertRow(lastRow);row.setAttribute('id','cat-'+theForm.tempCounter.value);td2.onclick=function(){delRowTable_associate(row)}
var cell0=row.insertCell(0);var textNode0=document.createTextNode(td0);cell0.style.width='45%';cell0.valign='middle';cell0.appendChild(textNode0);cell0.appendChild(hidCat);var cell1=row.insertCell(1);var textNode1=document.createTextNode(td1);cell1.style.width='45%';cell1.align='center';cell1.valign='middle';cell1.appendChild(textNode1);var cell2=row.insertCell(2);cell2.style.width='10%';cell2.valign='middle';cell2.align='right';cell2.style.padding='8px';cell2.appendChild(td2);}
else
{alert('This category already exists.');}
return true;}
function delRowTable_associate(tr)
{if(confirm('Are you sure you want to delete this record?'))
{if(document.getElementById('cat-'+tr))
{var tbl=document.getElementById('tblDynamic');var ind=document.getElementById('cat-'+tr).rowIndex;tbl.deleteRow(ind);}
else
{tr.parentNode.removeChild(tr);}}
return false;}
function enableIDs(IDs)
{var IDs=IDs.split(',');for(i=0;i<IDs.length;i++)
{e=document.getElementById(IDs[i]);e.disabled="";}}
function disableIDs(IDs)
{var IDs=IDs.split(',');for(i=0;i<IDs.length;i++)
{e=document.getElementById(IDs[i]);e.disabled="true";}}
function showHiddenIDs(IDs)
{var IDs=IDs.split(',');for(i=0;i<IDs.length;i++)
{new Effect.Appear(IDs[i],{duration:0.0,from:0.1,to:1.0});}}
function hideIDs(IDs)
{var IDs=IDs.split(',');for(i=0;i<IDs.length;i++)
{new Effect.Fade(IDs[i],{duration:0.0});}}
function check_mandatory(theForm)
{id=self.setInterval("show_mandatory(document.getElementById('"+theForm+"'))",200);}
function show_mandatory(theForm)
{if(theForm.cat_level2.length>1)
{showHiddenIDs("sub-cat");enableIDs("cat_level2");}}
function my_check_mandatory(theForm)
{id=self.setInterval("my_show_mandatory(document.getElementById('"+theForm+"'))",200);}
function my_show_mandatory(theForm)
{if(theForm.cat_level2.length>1)
enableIDs("cat_level2");if(theForm.cat_level3.length>1)
enableIDs("cat_level2,cat_level3");}
function PrintThisContent(prn_url)
{var sOption="toolbar=no,location=no,directories=no,menubar=no,";sOption+="scrollbars=yes,width=640,height=480,left=0,top=0";MM_openBrWindow(prn_url,'print_profile_window',sOption);}
function PrintThisContent_js()
{var sWinHTML;sWinHTML=document.getElementById("print_profile_type").innerHTML;sWinHTML+=document.getElementById("print_innerfull").innerHTML;var class_file="print_style";var addl_path="";var popup_content='<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>:: ClickSize ::</title><link href="css/'+class_file+'.css" rel="stylesheet" type="text/css"></head><body><table width="500"  border="0" cellspacing="0" cellpadding="0" align="center"><tr><td><img src="images/clr.gif" width="1" height="1" alt=""></td></tr><tr><td id="welcom-bg"><img src="images/clr.gif" width="1" height="2" alt=""></td></tr><tr><td style="padding:15px;"><!--img src="'+addl_path+'images/logo1.gif" title="ClickSize"--></td></tr><tr><td bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1"><tr><td>'+sWinHTML+'</td></tr><tr class="trbglc"><td align="center"><img src="images/clr.gif" alt="" width="1" height="1"></td></tr></table></td></tr></table><table width="580" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td height="24" align="center" class="bottom-link-bg">Copyright &copy; 2007, clicksize.com. All Rights Reserved.</td></tr></table></body></html>';var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,";sOption+="scrollbars=yes,width=1024,height=768,left=0,top=0";var winprint=window.open("","",sOption);winprint.document.open();winprint.document.write(popup_content);winprint.print();winprint.document.close();winprint.focus();}
function checkDecimals(fieldName,fieldValue)
{decallowed=2;if(isNaN(fieldValue)||fieldValue=="")
{alert("Not a valid number.");fieldName.select();fieldName.focus();}
else
{if(fieldValue.indexOf('.')==-1)fieldValue+=".";dectext=fieldValue.substring(fieldValue.indexOf('.')+1,fieldValue.length);if(dectext.length>decallowed)
{alert("Enter a number with up to "+decallowed+" decimal places.");fieldName.select();fieldName.focus();}}}
function check_all(ccount,ccheck)
{if(document.getElementById('checkStatus').value=="")
{document.getElementById('checkStatus').value="Check";for(i=1;i<document.getElementById(''+ccount+'').value;i++)
{document.getElementById(''+ccheck+'_'+i).checked=true;}}
else
{document.getElementById('checkStatus').value="";for(i=1;i<document.getElementById(''+ccount+'').value;i++)
{document.getElementById(''+ccheck+'_'+i).checked=false;}}}
function chkOptions_all(act,theForm,ccheckbox,ccount)
{if(chkOptions(theForm,ccheckbox))
{if(act=='A')
{if(confirm('Are you sure you want to activate these records?'));else
return false;}
else if(act=='D')
{if(confirm('Are you sure you want to deactivate these records?'));else
return false;}
else if(act=='Delete')
{if(confirm('Are you sure you want to delete these records?'));else
return false;}
else if(act=='R')
{if(confirm('Are you sure you want to restore these records?'));else
return false;}
var strChkId='';delChkID='';var i;for(i=0;i<theForm.elements.length;i++)
{if(theForm.elements[i].name==''+ccheckbox+'[]'&&theForm.elements[i].checked)
{var strChkId=theForm.elements[i].value;if(act=='A')
{xajax_update_status(strChkId,'D');}
else if(act=='D')
{xajax_update_status(strChkId,'A');}
else if(act=='R')
{xajax_update_status(strChkId,'R');}
if(delChkID=="")
{var delChkID=theForm.elements[i].value;}
else
delChkID=delChkID+","+theForm.elements[i].value;}}
for(i=1;i<document.getElementById(''+ccount+'').value;i++)
{document.getElementById(''+ccheckbox+'_'+i).checked=false;}
document.getElementById('checkStatus').value="";if(act=='Delete')
{xajax_deleteRow(delChkID);}}
else
{return false;}}
function chkAll_Options(act,theForm)
{if(act=='edit')
{xajax_editmode(editChkID);}
if(act=='Delete')
{xajax_deleteRow(delChkID);}}
function chkOptions(theForm,ccheckbox)
{var resVal='';for(i=0;i<theForm.elements.length;i++)
{if(theForm.elements[i].name==''+ccheckbox+'[]'&&theForm.elements[i].checked)
{if(resVal=="")
var resVal=theForm.elements[i].value;else
resVal=resVal+","+theForm.elements[i].value;}}
if(resVal=='')
{alert('Please select a record.');return false;}
else
{return true;}}
function call_page_after_delete(pagid,pageurl)
{sk_ajax_request(pageurl,'&page='+pagid+'&pagin=1','txtResult');}
function fnCopyBillToShip(chkObject,theForm)
{var arrayCount=0;var formField;formFieldShippingArray=new Array("vchShippingFName","vchShippingMName","vchShippingLName","vchShippingStreetName","vchShippingAptNumber","vchShippingCity","intShippingCountry","vchShippingState","vchShippingOtherState","vchShippingZipcode");formFieldBillingArray=new Array("vchFName","vchMName","vchLName","vchStreetName","vchAptNumber","vchCity","intCountryID","vchStateName","Otherstatename","vchZipCode");if(formFieldBillingArray.length>0)
{for(arrayCount=0;arrayCount<formFieldBillingArray.length;arrayCount++)
{if(chkObject.checked==true)
{if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='vchStateName')
{var billingStateID=theForm.elements[(formFieldBillingArray[arrayCount])].value;display_shipping_state(countryID,billingStateID);}
if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='intCountryID'&&theForm.elements[(formFieldBillingArray[arrayCount])].value=='230')
{var countryID=theForm.elements[(formFieldBillingArray[arrayCount])].value;}
else if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='intCountryID'&&theForm.elements[(formFieldBillingArray[arrayCount])].value!='230')
{display_shipping_state(theForm.elements[(formFieldBillingArray[arrayCount])].value,'');}
theForm.elements[(formFieldShippingArray[arrayCount])].value=theForm.elements[(formFieldBillingArray[arrayCount])].value;}
else
{theForm.elements[(formFieldShippingArray[arrayCount])].readOnly=false;theForm.vchShippingState.disabled=false;theForm.vchShippingOtherState.disabled=false;theForm.intShippingCountry.disabled=false;}}}}
function checkall(ccount,ccheck)
{if(document.getElementById('checkStatus1').value=="")
{document.getElementById('checkStatus1').value="Check";for(i=1;i<document.getElementById(''+ccount+'').value;i++)
{document.getElementById(''+ccheck+'_'+i).checked=true;}}
else
{document.getElementById('checkStatus1').value="";for(i=1;i<document.getElementById(''+ccount+'').value;i++)
{document.getElementById(''+ccheck+'_'+i).checked=false;}}}
function chk_optionsAll(act,theForm,ccheckbox,ccount,param)
{if(chkOptions(theForm,ccheckbox))
{if(act=='A')
{if(confirm('Are you sure you want to activate these records?'));else
return false;}
else if(act=='D')
{if(confirm('Are you sure you want to deactivate these records?'));else
return false;}
else if(act=='Delete')
{if(confirm('Are you sure you want to delete these records?'));else
return false;}
var strChkId='';delChkID='';var i;for(i=0;i<theForm.elements.length;i++)
{if(theForm.elements[i].name==''+ccheckbox+'[]'&&theForm.elements[i].checked)
{var strChkId=theForm.elements[i].value;if(act=='A')
{xajax_update_status(strChkId,'D',param);}
else if(act=='D')
{xajax_update_status(strChkId,'A',param);}
if(delChkID=="")
{var delChkID=theForm.elements[i].value;}
else
delChkID=delChkID+","+theForm.elements[i].value;}}
for(i=1;i<document.getElementById(''+ccount+'').value;i++)
{document.getElementById(''+ccheckbox+'_'+i).checked=false;}
if((param=="country")||(param=="shippingzone"))
{document.getElementById('checkStatus1').value="";}
if(param=="shipzoneDetail")
{document.getElementById('checkStatus2').value="";}
else
{document.getElementById('checkStatus').value="";}
if(act=='Delete')
{xajax_deleteRow(delChkID,param);}}
else
{return false;}}
function fnCopyMailingToBusiness(chkObject,theForm)
{var arrayCount=0;var formField;formFieldShippingArray=new Array("vchBusinessStreetName","vchBusinessAptNumber","vchBusinessCity","intBusinessCountry","vchBusinessState","vchBusinessOtherState","vchBusinessZipcode");formFieldBillingArray=new Array("vchStreetName","vchAptNumber","vchCity","intCountryID","vchStateName","Otherstatename","vchZipCode");if(formFieldBillingArray.length>0)
{for(arrayCount=0;arrayCount<formFieldBillingArray.length;arrayCount++)
{if(chkObject.checked==true)
{if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='vchStateName')
{var billingStateID=theForm.elements[(formFieldBillingArray[arrayCount])].value;display_business_state(countryID,billingStateID);}
if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='intCountryID'&&theForm.elements[(formFieldBillingArray[arrayCount])].value=='230')
{var countryID=theForm.elements[(formFieldBillingArray[arrayCount])].value;}
else if(theForm.elements[(formFieldBillingArray[arrayCount])].name=='intCountryID'&&theForm.elements[(formFieldBillingArray[arrayCount])].value!='230')
{display_business_state(theForm.elements[(formFieldBillingArray[arrayCount])].value,'');}
theForm.elements[(formFieldShippingArray[arrayCount])].value=theForm.elements[(formFieldBillingArray[arrayCount])].value;}
else
{theForm.elements[(formFieldShippingArray[arrayCount])].readOnly=false;theForm.vchBusinessState.disabled=false;theForm.vchBusinessOtherState.disabled=false;theForm.intBusinessCountry.disabled=false;}}}}
function GetMouseCoords(e,t)
{e=(e)?e:window.event;var x=0;var y=0;if(e.pageX)
{x=e.pageX;y=e.pageY;}
else if(e.clientX)
{x=e.clientX+document.body.scrollLeft;y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}
if(t=='comment')
showAddComment(x,y);else if(t=='fraud')
showAddReason(x,y);else if(t=='register')
showhideRegister(x,y);else if(t=='upgrade')
showhideUpgrade(x,y);else if(t=='upgrade1')
showhideUpgrade1(x,y);}
function deleteImg(imgid,productid)
{if(confirm("Are you sure you want to Delete this Image ?"))
{xajax_deleteImg(imgid,productid);}}
function ShowImage(countImg,act)
{theForm=document.frmProduct;var multi_selector=new MultiSelector(document.getElementById('files_list'),countImg,act,theForm);multi_selector.addElement(document.getElementById('my_file_element'));}
function getcategory()
{category=document.getElementById('Categoryselect').value;xajax_getCategory(category);}
var timerID=0;var LastQ="";var failures=0;function send_form(b)
{var m=document.getElementById('loadingmsg');var req=document.frmMatchingProducts.querystr.value;if(req==LastQ){return false;}
if(document.frmMatchingProducts.querystr.value.length<=3){m.innerHTML='Product name too short.';return false;}
if(timerID!=0){clearTimeout(timerID);timerID=0;}
if(b){timerID=setTimeout("send_form(false)",1000);failures=0;return false;}
try
{xajax_getsearchresult(req);m.innerHTML="searching...";LastQ=req;failures=0;}
catch(error)
{m.innerHTML='searching....';failures++;if(timerID)
clearTimeout(timerID);if(failures<5){timerID=setTimeout("send_form(false)",1000);}else{m.innerHTML='No response from server. Try again later.';}}
return false;}
function invoke(option)
{var node=document.frmMatchingProducts.cnet_product;var s=option.split('\n');var i=0;var fields;while(node.options.length!=0)
node.options[0]=null;for(i=0;i<s.length-1;i++){fields=s[i].split(' ');node.options[node.length]=new Option(fields[0],fields[0]);}
node.disabled=false;document.frmMatchingProducts.cnetbutton.disabled=true;var m=document.getElementById('loadingmsg');if(node.length>=10){m.innerHTML='More than 10 results. Most relevant products shown below.';}else
if(node.length>=1){m.innerHTML=(node.length)+' product(s) returned.';}else{m.innerHTML='No products found.';}
return true;}
function getvisibleNext(productcategory)
{if(productcategory!="")
{document.frmMatchingProducts.cnetbutton.style.display="";}}
function getcnetDetail()
{cnetcategory=document.getElementById('cnet_product').value;if(cnetcategory!='')
{xajax_getcnetcategory(cnetcategory);document.getElementById('stepY').style.display='';TabbedPanels1.showPanel(2);}else{alert('please select a Product');return false;}}
function addGeolocation()
{continent=document.getElementById('Continent').value;country=document.getElementById('Country').value;productid=document.getElementById('productid').value;if(continent==''&&country=='')
{alert('please select both continent and country');return false;}else{xajax_addGeolocation(continent,country,productid);}}
function addTmpGeolocation()
{continent=document.getElementById('Continent').value;country=document.getElementById('Country').value;productid=document.getElementById('productid').value;if(continent==''&&country=='')
{alert('please select both continent and country');return false;}else{xajax_addTmpGeolocation(continent,country,productid);}}
function deleteGeoLoc(geolocid)
{productid=document.getElementById('productid').value;if(confirm("Are you sure you want to Delete this Geo location ?"))
{xajax_deleteGeoLocation(geolocid,productid);}}
function deleteTmpGeoLoc(geolocid)
{if(confirm("Are you sure you want to Delete this Geo location ?"))
{xajax_deleteTmpGeoLocation(geolocid,'','');}}
function addMyPreferenceGeolocation()
{continent=document.getElementById('Continent').value;country=document.getElementById('Country').value;if(continent==''&&country=='')
{alert('please select both continent and country');return false;}else{xajax_addGeolocation(continent,country,'');}}
function addMyPreferAvNewsTmpGeolocation()
{continent=document.getElementById('Continent1').value;country=document.getElementById('Country1').value;var category='';ob=document.frmPreferences.Categoryselect;selected=new Array();for(var i=0;i<ob.length;i++)
{if(ob.options[i].selected)
{category+=ob.options[i].value+',';}}
if(category=='')
{alert('please select Category first');return false;}else{if(continent==''&&country=='')
{alert('please select both continent and country');return false;}else{xajax_addTmpGeolocation(continent,country,category);}}}
function addMyPrefernceAvNewsTmpZipCode()
{FromZipCode=document.getElementById('FromZipCode').value;ToZipCode=document.getElementById('ToZipCode').value;var category='';ob=document.frmPreferences.Categoryselect;selected=new Array();for(var i=0;i<ob.length;i++)
{if(ob.options[i].selected)
{category+=ob.options[i].value+',';}}
if(category=='')
{alert('please select Category first');return false;}else{if(isNaN(ToZipCode))
{alert('please Enter  numeric zip To code ');return false;}
if(isNaN(FromZipCode))
{alert('please Enter  numeric zip From code ');return false;}
if((ToZipCode==0)&&(FromZipCode==0))
{alert('please Enter both Zip and correct ');return false;}else{xajax_addTmpZipCode(ToZipCode,FromZipCode,category);}}}
function addMyPreferAvStoreTmpGeolocation()
{continent=document.getElementById('Continent').value;country=document.getElementById('Country').value;if(continent==''&&country=='')
{alert('please select both continent and country');return false;}else{xajax_addTmpGeolocation(continent,country);}}
function deleteMyPreferncesAvNewsGeoLoc(geolocid)
{if(confirm("Are you sure you want to Delete this Geo location ?"))
{xajax_deleteGeoLocation(geolocid,'','MY');}}
function deleteOtherPreferncesAvNewsGeoLoc(geolocid)
{if(confirm("Are you sure you want to Delete this Geo location ?"))
{xajax_deleteGeoLocation(geolocid,'','OT');}}
function deleteMyPrefernecesAvNewsZipCode(geolocid)
{if(confirm("Are you sure you want to Delete this Geo location ?"))
{xajax_deleteZipCode(geolocid,'','');}}
function deleteMyPreferncesAvNewsTmpZipCode(geolocid)
{if(confirm("Are you sure you want to Delete this Zip code ?"))
{xajax_deleteTmpZipCode(geolocid,'','tmp');}}
function deleteMyPrefencesAvNewsTmpGeoLoc(geolocid)
{if(confirm("Are you sure you want to Delete this Geo location ?"))
{xajax_deleteTmpGeoLocation(geolocid,'','');}}
function changeAvNewsSearchMemberpage(theForm,val)
{sortValue=document.getElementById('sortBy').value;var sortOrder='';xajax_searchResult(theForm.keyword.value,theForm.country.value,theForm.serachBy.value,theForm.dateCrtieria.value,theForm.TimeCriteria.value,theForm.dtStartDate.value,theForm.dtEndDate.value,theForm.Categoryselect.value,theForm.PriceStart.value,theForm.PriceEnd.value,val,sortOrder,sortValue);return false;}
function AvNewsSearchMembrArea(theForm,sortOrder)
{current_dt_temp=new Date();current_dt=new Date(current_dt_temp.getFullYear(),current_dt_temp.getMonth(),current_dt_temp.getDate());dtrecStartDate=new Date(document.getElementsByName('dtStartDate')[0].value);dtrecEndDate=new Date(document.getElementsByName('dtEndDate')[0].value);if(dtrecEndDate<dtrecStartDate)
{alert("End Date must be greater than start date.");return false;}else{var m=document.getElementById('loadingmsg');var optionVal=0;var len=theForm.elements.length;for(var i=0;i<len;i++)
{if(theForm.elements[i].type=="radio")
{if(theForm.elements[i].checked==true&&theForm.elements[i].name=='serachBy')
{var optionVal=theForm.elements[i].value;}}}
if(document.getElementById('dateCrtieria').value!="")
{if(document.getElementById('dateCrtieria').value<0)
{alert("Please enter a value greater than 0 for Date Range.")
document.getElementById('dateCrtieria').focus();return false;}
if(isNaN(document.getElementById('dateCrtieria').value))
{alert("Please enter a numeric value for Date Range.");document.getElementById('dateCrtieria').focus();return false;}}
var val=document.getElementById('PageNum').value
sortValue=document.getElementById('sortBy').value;xajax_searchResult(theForm.keyword.value,theForm.country.value,optionVal,theForm.dateCrtieria.value,theForm.TimeCriteria.value,theForm.dtStartDate.value,theForm.dtEndDate.value,theForm.Categoryselect.value,theForm.PriceStart.value,theForm.PriceEnd.value,val,sortOrder,sortValue);m.innerHTML="Searching...";return false;}
return false;}
function searchTitle(obj)
{if(obj.value=="Enter Product Name / ID to search")
obj.value="";else return;}
function checkcsv(theForm)
{xajax_saveCsv(xajax.getFormValues(theForm));}
function GetMouseCoords(div,e)
{alert("here here");e=(e)?e:window.event;var x=0;var y=0;if(e.pageX)
{x=e.pageX;y=e.pageY;}
else if(e.clientX)
{x=e.clientX+document.body.scrollLeft;y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}
showdiv(div,x,y);}
function showdiv(div,x,y)
{document.getElementById(div).style.top=y+"px";document.getElementById(div).style.left="200px";document.getElementById(div).style.display='';return false;}
