
function XmlHttpI(xmlHttp){var xmlHttp=false;if(!xmlHttp&&typeof XMLHttpRequest!='undefined'){xmlHttp=new XMLHttpRequest();}
return xmlHttp;}
xmlHttp=XmlHttpI('xmlHttp');xmlHttp1=XmlHttpI('xmlHttp1');xmlHttp2=XmlHttpI('xmlHttp2');xmlHttp3=XmlHttpI('xmlHttp3');function getpr(cid,ci){var time=new Date().getTime();var url="/admin.php?module=Goods&action=GetPr&cid="+cid+'&time='+time;xmlHttp.open("GET",url,true);xmlHttp.onreadystatechange=rtmsg;xmlHttp.send(null);var url1="/admin.php?module=Goods&action=GetSPr&cid="+cid+'&time='+time;xmlHttp1.open("GET",url1,true);xmlHttp1.onreadystatechange=srtmsg;xmlHttp1.send(null);if(ci==1){var url2="/admin.php?module=Goods&action=GetBrand&cid="+cid+'&time='+time;xmlHttp2.open("GET",url2,true);xmlHttp2.onreadystatechange=brtmsg;xmlHttp2.send(null);}
var url3="/admin.php?module=Goods&action=GetCname&cid="+cid+'&time='+time;xmlHttp3.open("GET",url3,true);xmlHttp3.onreadystatechange=cnamemsg;xmlHttp3.send(null);}
function getbrand(cid){var time=new Date().getTime();var url2="/admin.php?module=Goods&action=GetBrand&cid="+cid+'&time='+time;xmlHttp2.open("GET",url2,true);xmlHttp2.onreadystatechange=brtmsg;xmlHttp2.send(null);}
function cnamemsg(){if(xmlHttp3.readyState==4){var response3=xmlHttp3.responseText;response3=response3.split('||||');document.getElementById("mkdir").value=response3[0];}}
function rtmsg(){if(xmlHttp.readyState==2){document.getElementById('pr').innerHTML='Loading...<img src="/templates/AdminViews/images/ajaxloader.gif">';}
if(xmlHttp.readyState==4){var response=xmlHttp.responseText;response=response.split('||||');document.getElementById('pr').innerHTML=response[0];}}
function getspr(cid){var url="/admin.php?module=Goods&action=GetSPr&cid="+cid;xmlHttp.open("GET",url,true);xmlHttp.onreadystatechange=srtmsg;xmlHttp.send(null);}
function srtmsg(){if(xmlHttp1.readyState==4){var response1=xmlHttp1.responseText;response1=response1.split('||||');document.getElementById('spr1').innerHTML=response1[0];document.getElementById('spr2').innerHTML=response1[1];document.getElementById('sprvalue1').value=response1[2];document.getElementById('sprvalue2').value=response1[3];}}
function brtmsg(){if(xmlHttp2.readyState==2){document.getElementById('brand').innerHTML='Loading...<img src="/templates/AdminViews/images/ajaxloader.gif" />';}
if(xmlHttp2.readyState==4){var response2=xmlHttp2.responseText;response2=response2.split('||||');document.getElementById('brand').innerHTML=response2[0];}}
function isNull(str){if(str=="")return true;var regu="^[ ]+$";var re=new RegExp(regu);return re.test(str);}
function isInteger(str){var regu=/^[-]{0,1}[0-9]{1,}$/;return regu.test(str);}
function isNumber(s){var regu="^[0-9]+$";var re=new RegExp(regu);if(s.search(re)!=-1){return true;}else{return false;}}
function isEmail(str){var myReg=/^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/;if(myReg.test(str))return true;return false;}
function RefreshImage(){var el=document.getElementById("code");var src=$("#code").attr("src");$("#code").attr("src",src+"?");}
function CheckModule(){var strobj=document.getElementById('CheckedValue');var str=strobj.value;str=str.split('|');var str1=' ';for(var j=0;j<str.length;j++){str1='Per'+str[j]+'mission'+' '+str1;}
var el=document.getElementsByTagName('input');var len=el.length;for(var i=0;i<len;i++)
{if(el[i].type=="checkbox"){var id=el[i].id;if(str1.indexOf('Per'+id+'mission')!=-1)
{el[i].checked=true;}}}}
function CheckAll(check){var el=document.getElementsByTagName('input');var len=el.length;for(var i=0;i<len;i++)
{if(el[i].type=="checkbox"){var id=el[i].id;if(check=='forall'){if(id=='fornone'){el[i].checked=true;}else{el[i].checked='';}}else{if(id==check){el[i].checked='';}else{el[i].checked=true;}}}}}
function CheckedAll(obj){var el=document.getElementsByTagName('input');var len=el.length;for(var i=0;i<len;i++)
{if(el[i].type=="checkbox"){el[i].checked=obj.checked;}}}
function modalDialog(url,name,width,height)
{var time=new Date().getTime();url=url+'?time='+time;if(width==undefined)
{width=400;}
if(height==undefined)
{height=300;}
if(name=='calculator')
{window.showModalDialog(url,name,'dialogWidth='+(width)+'px; dialogHeight='+(height+5)+'px; status=off');}
else
{x=(window.screen.width-width)/2;y=(window.screen.height-height)/2;window.open(url,name,'height='+height+', width='+width+', left='+x+', top='+y+', toolbar=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, modal=yes');}}
