
var showHideStatus='n';function showHide(id)
{if(showHideStatus=='n')
{document.getElementById(id).style.display='block';showHideStatus='y';}
else if(showHideStatus=='y')
{document.getElementById(id).style.display='none';showHideStatus='n';}}
function hide(did)
{document.getElementById(did).style.display='none';showHideStatus='n';}
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 updateSequence(id,param,page)
{xajax_update_sequence(id,param,page);}
function deleterow(id,type)
{if(confirm("Are you sure you want to Delete this category?"))
{xajax_deleteRow(id,type);}}
function deleterow(id)
{if(confirm("Are you sure you want to Delete this category?"))
{xajax_deleteRow(id);}}
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 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)
{alert(ccount);alert(ccheckbox);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');}
else if(act=='D')
{xajax_update_status(strChkId,'A');}
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 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 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;}}}}
var OpenedMenu="";var openimg="";function showHideMenu(menu,img)
{if(document.getElementById(menu).style.display=='')
{document.getElementById(menu).style.display='none';OpenedMenu="";openimg="";document.getElementById(img).src='/images/scrolldown.png';}
else
{document.getElementById(menu).style.display='';document.getElementById(img).src='/images/scrollup.png';OpenedMenu=menu;openimg=img;}
return false;}
function show_hideslide_gallery_script()
{hs.graphicsDir='/admin/javascript/highslide/graphics/';hs.align='center';hs.transitions=['expand','crossfade'];hs.fadeInOut=true;hs.dimmingOpacity=0.8;hs.outlineType='rounded-white';hs.captionEval='this.thumb.alt';hs.marginBottom=105
hs.numberPosition='caption';hs.addSlideshow({interval:5000,repeat:false,useControls:true,overlayOptions:{className:'text-controls',position:'bottom center',relativeTo:'viewport',offsetY:-60},thumbstrip:{position:'bottom center',mode:'horizontal',relativeTo:'viewport'}});}
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];}}
