function trim(sString){if(sString){while(sString.substring(0,1)==' ')
{sString=sString.substring(1,sString.length);}
while(sString.substring(sString.length-1,sString.length)==' ')
{sString=sString.substring(0,sString.length-1);}}
return sString;}
function changeText(obj,defaultVal,type){if(trim(obj.value)==''&&type=='blur'){obj.value=defaultVal;}
if(obj.value==defaultVal&&type=='focus'){obj.value='';}}
function popupWindow(url,width,height,resizable,scrollbars,top,left){if(trim(url)!=''){if(width==''){width=150;}
if(height==''){height=150;}
resizable=resizable;if(resizable==''){resizable='yes';}
scrollbars=scrollbars;if(scrollbars==''){scrollbars='no';}
if(top==''){top=50;}
if(left==''){left=50;}
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollbars+',resizable='+resizable+',copyhistory=no,width='+width+',height='+height+',top='+top+',left='+left);}}
function OpenHelp(url){url="studio_help.php";window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=930,height=625,top=50,left=50');}
function emailValidate(email){var error='';var emailFilter=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(email.search(emailFilter)==-1){error="error";}
return error;}
function isNumber(numstr,errString){numdecs=0;for(i=0;i<numstr.length;i++){mychar=numstr.charAt(i);if((mychar>="0"&&mychar<="9")||mychar=="."){if(mychar==".")
numdecs++;}else{return errString;}}
if(numdecs>1){return errString;}
return'';}
function isCurrency(numstr,errString,dec_point,thousand_sep){if(dec_point==''||(thousand_sep!='.'&&thousand_sep!="")){dec_point='.';}
if(thousand_sep==''||(dec_point!=','&&dec_point!="")){thousand_sep=',';}
numdecs=0;for(i=0;i<numstr.length;i++){mychar=numstr.charAt(i);if((mychar>="0"&&mychar<="9")||mychar==dec_point||mychar==thousand_sep){if(mychar==dec_point)
numdecs++;}else{return errString;}}
if(numdecs>1){return errString;}
return'';}
function GetXmlHttpObject(handler)
{var objXmlHttp=null
if(navigator.userAgent.indexOf("Opera")>=0)
{alert("This Site 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 calcnumericvalidation(numstr,txtname,errorstr){numdecs=0;for(i=0;i<numstr.length;i++){mychar=numstr.charAt(i);if((mychar>="0"&&mychar<="9")){numdecs++;}else{alert(errorstr);eval("document.getElementById('"+txtname+"').value='';");return false;}}
return true;}
