function SetFocus(TargetFormName){var target=0;if(TargetFormName!=""){for(i=0;i<document.forms.length;i++){if(document.forms[i].name==TargetFormName){target=i;break;}}}
var TargetForm=document.forms[target];for(i=0;i<TargetForm.length;i++){if((TargetForm.elements[i].type!="image")&&(TargetForm.elements[i].type!="hidden")&&(TargetForm.elements[i].type!="reset")&&(TargetForm.elements[i].type!="submit")){TargetForm.elements[i].focus();if((TargetForm.elements[i].type=="text")||(TargetForm.elements[i].type=="password")){TargetForm.elements[i].select();}
break;}}}
function RemoveFormatString(TargetElement,FormatString){if(TargetElement.value==FormatString){TargetElement.value="";}
TargetElement.select();}
function CheckDateRange(from,to){if(Date.parse(from.value)<=Date.parse(to.value)){return true;}else{return false;}}
function IsValidDate(DateToCheck,FormatString){var strDateToCheck;var strDateToCheckArray;var strFormatArray;var strFormatString;var strDay;var strMonth;var strYear;var intday;var intMonth;var intYear;var intDateSeparatorIdx=-1;var intFormatSeparatorIdx=-1;var strSeparatorArray=new Array("-"," ","/",".");var strMonthArray=new Array("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");var intDaysArray=new Array(31,28,31,30,31,30,31,31,30,31,30,31);strDateToCheck=DateToCheck.toLowerCase();strFormatString=FormatString.toLowerCase();if(strDateToCheck.length!=strFormatString.length){return false;}
for(i=0;i<strSeparatorArray.length;i++){if(strFormatString.indexOf(strSeparatorArray[i])!=-1){intFormatSeparatorIdx=i;break;}}
for(i=0;i<strSeparatorArray.length;i++){if(strDateToCheck.indexOf(strSeparatorArray[i])!=-1){intDateSeparatorIdx=i;break;}}
if(intDateSeparatorIdx!=intFormatSeparatorIdx){return false;}
if(intDateSeparatorIdx!=-1){strFormatArray=strFormatString.split(strSeparatorArray[intFormatSeparatorIdx]);if(strFormatArray.length!=3){return false;}
strDateToCheckArray=strDateToCheck.split(strSeparatorArray[intDateSeparatorIdx]);if(strDateToCheckArray.length!=3){return false;}
for(i=0;i<strFormatArray.length;i++){if(strFormatArray[i]=='mm'||strFormatArray[i]=='mmm'){strMonth=strDateToCheckArray[i];}
if(strFormatArray[i]=='dd'){strDay=strDateToCheckArray[i];}
if(strFormatArray[i]=='yyyy'){strYear=strDateToCheckArray[i];}}}else{if(FormatString.length>7){if(strFormatString.indexOf('mmm')==-1){strMonth=strDateToCheck.substring(strFormatString.indexOf('mm'),2);}else{strMonth=strDateToCheck.substring(strFormatString.indexOf('mmm'),3);}
strDay=strDateToCheck.substring(strFormatString.indexOf('dd'),2);strYear=strDateToCheck.substring(strFormatString.indexOf('yyyy'),2);}else{return false;}}
if(strYear.length!=4){return false;}
intday=parseInt(strDay,10);if(isNaN(intday)){return false;}
if(intday<1){return false;}
intMonth=parseInt(strMonth,10);if(isNaN(intMonth)){for(i=0;i<strMonthArray.length;i++){if(strMonth==strMonthArray[i]){intMonth=i+1;break;}}
if(isNaN(intMonth)){return false;}}
if(intMonth>12||intMonth<1){return false;}
intYear=parseInt(strYear,10);if(isNaN(intYear)){return false;}
if(IsLeapYear(intYear)==true){intDaysArray[1]=29;}
if(intday>intDaysArray[intMonth-1]){return false;}
return true;}
function IsLeapYear(intYear){if(intYear%100==0){if(intYear%400==0){return true;}}else{if((intYear%4)==0){return true;}}
return false;}
function giftCategories(){var TimerId=0;document.getElementById('giftCategories').style.display='block';}
function giftCategoriesReset(){clearTimeout(TimerId);}
function giftCategoriesHide(){TimerId=setTimeout("document.getElementById('giftCategories').style.display = 'none'",500);}
var xmlHttp
var htmlId
var x
var y
function $$(id){return document.getElementById(id);}
function GetXmlHttpObject(handler){var objXmlHttp=null
if(navigator.userAgent.indexOf("Opera")>=0){alert("This example doesn't work in Opera")
return}
if(navigator.userAgent.indexOf("MSIE")>=0){var strName="Msxml2.XMLHTTP"
if(navigator.appVersion.indexOf("MSIE 5.5")>=0){strName="Microsoft.XMLHTTP"}
try{objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler
return objXmlHttp}
catch(e){alert("Error. Scripting for ActiveX might be disabled")
return}}
if(navigator.userAgent.indexOf("Mozilla")>=0){objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler
return objXmlHttp}}
function stateChanged(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){if($$(htmlId).innerHTML)
$$(htmlId).innerHTML=xmlHttp.responseText}}
function ajax_show(url,id){htmlId=id;xmlHttp=GetXmlHttpObject(stateChanged);xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function ajax_show_event(url,id,e){htmlId=id;document.getElementById(htmlId).style.left=e.clientX;document.getElementById(htmlId).style.top=e.clientY;xmlHttp=GetXmlHttpObject(stateChanged);xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}
return n};ajax={};ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}
catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}
catch(e){return new XMLHttpRequest()}}};ajax.serialize=function(f){var g=function(n){return f.getElementsByTagName(n)};var nv=function(e){if(e.name)
return encodeURIComponent(e.name)+'='+encodeURIComponent(e.value);else return''};var i=collect(g('input'),function(i){if((i.type!='radio'&&i.type!='checkbox')||i.checked)return nv(i)});var s=collect(g('select'),nv);var t=collect(g('textarea'),nv);return i.concat(s).concat(t).join('&');};ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)
f(x.responseText)};if(m=='POST')
x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};ajax.get=function(url,func){ajax.send(url,func,'GET')};ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText};ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};ajax.update=function(url,elm){var e=$$(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};ajax.submit=function(url,elm,frm){var e=$$(elm);var f=function(r){e.innerHTML=r;}
ajax.post(url,f,ajax.serialize(frm))};