//copyright 21star Co.Ltd
function star(){ }
//ajax function
star.prototype.Post = function (url,v,exp0,exp1,exp2) 
{
	eval(exp0);
    var obj = new ActiveXObject("MSXML2.XMLHTTP");
    obj.open("POST",url,true);
    obj.setRequestHeader("If-Modified-Since","0");
    obj.setRequestHeader("Cache-Control","no-cache"); 
    obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
    obj.send(v);
    obj.onreadystatechange=function(){
        if (obj.readyState==4)
        {
        ///////////////////////////////////////////////////////////////////////////
            if(obj.responsetext.length>3)
            {
                //alert(obj.responsetext);
            }
	        if (obj.statusText !="OK"){ eval(exp1);}else{ eval(exp2);}
        }
    }
}

star.prototype.Get = function (url,v,exp0,exp1,exp2)
{
	eval(exp0);
    var obj = new ActiveXObject("MSXML2.XMLHTTP");
    url = url + "?"+ v;
    obj.open("GET",url,true);
    obj.setRequestHeader("If-Modified-Since","0");
    obj.setRequestHeader("Cache-Control","no-cache"); 
    obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
    obj.send();
    obj.onreadystatechange=function(){
        if (obj.readyState==4)
        {
        ///////////////////////////////////////////////////////////////////////////////
            if(obj.responsetext.length>3)
            {
               //alert(obj.responsetext);
            }        
	        if (obj.statusText !="OK"){ eval(exp1);}else{ eval(exp2);}
        }
    }
}

//basic function
star.prototype.ChkNull = function (v,t)
{
	var vArr = new Array();
	vArr = v.split("|");
	tArr = t.split("|");
	for (j=0;j<=vArr.length-1;j++)
	{
		if (document.getElementById(vArr[j]).value=="")
		{
			alert(tArr[j]);
			document.getElementById(vArr[j]).focus();
			return false;
			break;
		}
	}
}

star.prototype.ChkEmail = function (v,t)
{
	var vArr = new Array();
	vArr = v.split("|");
	tArr = t.split("|");
	for (j=0;j<=vArr.length-1;j++)
	{
		if (document.getElementById(vArr[j]).value.indexOf("@") ==-1 || document.getElementById(vArr[j]).value.indexOf(".")== -1)
		{
			alert(tArr[j]);
			document.getElementById(vArr[j]).focus();
			return false;
			break;
		}
	}
}

star.prototype.NumOnly = function (id)
{
	var a = document.getElementById(id).value;
	b = a*1;
	if (b.toString()=="NaN"){return false;}else{return true;}
}

star.prototype.GetValue = function (v)
{
    var str = "";
    var vArr = new Array();
    vArr = v.split(",");
    
    if (vArr.length !=0 )
    {
        str += vArr[0] + "=" + document.getElementById(vArr[0]).value;
        for (j=1;j<=vArr.length-1;j++)
        {
	        str += "&"+ vArr[j] + "=" + document.getElementById(vArr[j]).value;
	    }       
    }
	
	return str;
}

var Obj=''
document.onmouseup=MUp
document.onmousemove=MMove

function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}

function MMove(){
if(Obj!=''){
 document.all(Obj).style.left=event.x-pX;
 document.all(Obj).style.top=event.y-pY;
 }
}

function MUp(){
if(Obj!=''){
 document.all(Obj).releaseCapture();
 Obj='';
 }
}


//&micro;&Ccedil;&Acirc;&frac14;
function G(id){
    return document.getElementById(id);
};
function GC(t){
   return document.createElement(t);
};
String.prototype.trim = function(){
          return this.replace(/(^\s*)|(\s*$)/g, '');
};
function isIE(){
      return (document.all && window.ActiveXObject && !window.opera) ? true : false;
} 
 
function cancelSign(){
    G("sign_div").style.display = 'none';
    G("cover_div").style.display = 'none';
   document.body.style.overflow = '';
};

function popCoverDiv(){
   if (G("cover_div")) {
    G("cover_div").style.display = '';
   } else {
    var coverDiv = GC('div');
    document.body.appendChild(coverDiv);
    coverDiv.id = 'cover_div';
    with(coverDiv.style) {
     position = 'absolute';
     background = '#CCCCCC';
     left = '0px';
     top = '0px';
     var bodySize = getBodySize();
     width = document.body.offsetWidth > document.body.scrollWidth ? document.body.offsetWidth : document.body.scrollWidth + 'px'
     height = document.body.offsetHeight > document.body.scrollHeight ? document.body.offsetHeight : document.body.scrollHeight + 'px';
     zIndex = 98;
     if (isIE()) {
      filter = "Alpha(Opacity=60)";
     } else {
      opacity = 0.6;
     }
    }
   }
}
function getBodySize(){
   var bodySize = [];
   with(document.documentElement) {
    bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;
    bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;
   }
   return bodySize;
}

var str="<div class='DivTipShow' id='DivCng' style='display: block; left: 189px; width: 268px; top: 187px; height: 200px; position: absolute; background:'>";
str += "<div style='padding: 5px; background: #7c7c7c'>";
str += "<div class='b2'>";
str += "<table border='0' width='260'  cellpadding='0' style='border-collapse: collapse'>";
str += "<tr style='cursor:move'>";
str += "<td height='25' onmousedown='MDown(DivCng)' width='23'>";
str += "<img border='0' src='login.gif' width='16' height='16'> </td>";
str += "<td height='25' onmousedown='MDown(DivCng)'><b>&Oacute;&Atilde;&raquo;?micro;&Ccedil;&Acirc;&frac14;</b></td>";
str += "</tr>";
str += "</table>";
str += "<table cellpadding='0' width='260' border='0' id='table1' style='border-collapse: collapse'>";
str += "<tr>";
str += "<td width='53' height='25'>&Oacute;&Atilde;&raquo;?Atilde;&ucirc;&pound;&ordm;</td>";
str += "<td width='207' height='25'><input type='text' class='box1' name='UserName' id='UserName'></td>";
str += "</tr>";
str += "<tr>";
str += "<td width='53' height='25'>&Atilde;&Uuml;&nbsp;&nbsp;&Acirc;&euml;&pound;&ordm;</td>";
str += "<td width='207' height='25'>";
str += "<input type='password' name='UserPwd' class='box1' id='UserPwd' size='20'></td>";
str += "</tr>";
str += "</table>";
str += "<table border='0' width='260'  cellpadding='0' style='border-collapse: collapse' id='table2'>";
str += "<tr>";
str += "<td height='30' align='center'>";
str += "<input type='submit' name='Confirm' id='Confirm' value='&micro;&Ccedil; &Acirc;&frac14;' class='ajaxbutton1'>&nbsp;&nbsp;<input type='button' onclick='cancelSign()' name='Cancel' class='ajaxbutton1' id='Cancel' value='&Egrave;&iexcl; &Iuml;&ucirc;' style=''></td>";
str += "</tr>";
str += "</table>";
str += "</div>";
str += "</div>";
str += "</div>";

function popSign(az_id,temp){
   var loginDivWidth = 300;
   var sign_in_flow = temp;

   if (G("sign_div")) {
    G("sign_div").style.display = '';
   } else {
    var signDiv = GC('div');
    document.body.appendChild(signDiv);
    signDiv.id = 'sign_div';
    signDiv.align = "center";
  
    with (signDiv.style) {
     position = 'absolute';
     left = (document.documentElement.clientWidth - loginDivWidth)/2 + 'px';
     top = (document.documentElement.clientHeight - 300)/2 + 'px';
     width = loginDivWidth + 'px';
     zIndex = 99;
     background = '#FFFFFF';
     //border = '#66CCFF solid 1px';
    }
   }
    G("sign_div").innerHTML = sign_in_flow;
}
function popSignFlow(az_id,temp) {
   popCoverDiv();  
   popSign(az_id,temp);  
   document.body.style.overflow = "scroll";
}

function SendTips(strTemp,btnTitle)
{
	var temp = "";
	temp += "<div class='DivTipShow' id='DivCng' style='display: block; left: 300px; width: 268px; top: 360px; height: 115px; position: absolute; background:'>";
	temp += "<div class='b2'><table border='1' width='100%' cellspacing='0' cellpadding='0' style='border-collapse: collapse' bordercolor='#C0C0C0'>";
	temp += "<tr><td bgcolor='#FFFFFF'>";
	temp += strTemp;
	temp += "<table border='0' width='260' cellpadding='0' style='border-collapse: collapse'>";
	temp += "<tr>";
	temp += "<td height='36' align='center'>";
	temp += "<input type='button' onclick='cancelSign()' name='Cancel' class='btn1' id='Cancel' value='"+ btnTitle +"'></td>";
	temp += "</tr>";
	temp += "</table>";
	temp += "</td></tr></table>";
	temp += "</div>";
	temp += "</div>";

	popSignFlow(6,temp);
}




