﻿function trim(str)
        {
	        var start = 0;
	        var end = str.length;
	        while (start < str.length && str.charAt(start) == ' ') start++;
	        while (end > 0 && str.charAt(end-1) == ' ') end--;
	        return str.substr(start, end-start);
        }
function check()
{
    //alert(document.getElementById("ctl00_ContentPlaceHolder1_txt_ten").value);
    var checkok=true;
    loi=0;
    document.getElementById("ctl00_ContentPlaceHolder1_la_ten").innerHTML="";
    document.getElementById("ctl00_ContentPlaceHolder1_Label1").innerHTML="";
    document.getElementById("ctl00_ContentPlaceHolder1_la_mail").innerHTML="";
    if(trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_ten").value).length==0)
    {
        document.getElementById("ctl00_ContentPlaceHolder1_la_ten").innerHTML="Bạn Chưa Nhập Tên !!!!";
        checkok=false;
    }
    if(trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_tendonvi").value).length==0)
    {
        document.getElementById("ctl00_ContentPlaceHolder1_Label1").innerHTML="Chưa Nhập Tên Đơn Vị !!!";
        checkok=false;
    }
    if(trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_sodt").value).length==0)
    {
        document.getElementById("ctl00_ContentPlaceHolder1_la_mail").innerHTML="Chưa Nhập Số Điện Thoại Của Bạn!!!!";   
        checkok=false;
    }
     if(trim(document.getElementById("ctl00_ContentPlaceHolder1_txt_sodt").value).length!=0)
    {
        if(isNaN(document.getElementById("ctl00_ContentPlaceHolder1_txt_sodt").value))
        {
            document.getElementById("ctl00_ContentPlaceHolder1_la_mail").innerHTML="Bạn Đã Nhập Sai Số Điện Thoại!!!!";   
            checkok=false;
        }
    }
    
    if(checkok)
        checkok = showdiv();
    return checkok;
}


function checkGiohang()
{
    
}
var pageWidth=0;
var pageHeight=0;
function getWinSize() 
{ 


if( window.innerHeight ) // Firefox 
{

d = (window.scrollMaxY > 0) ? 17 : 0; 

pageWidth = window.innerWidth + window.scrollMaxX - d;

pageHeight = window.innerHeight + window.scrollMaxY;


}


else if( document.body.scrollHeight > document.body.offsetHeight ) // all but Explorer Mac 
{

pageWidth = document.body.scrollWidth;

pageHeight = document.body.scrollHeight; 

}


else // works in Explorer 6 Strict, Mozilla (not FF) and Safari 
{ 

pageWidth = document.body.offsetWidth + document.body.offsetLeft; 

pageHeight = document.body.offsetHeight + document.body.offsetTop; 

}



//var winSize = new Array(pageWidth, pageHeight); 

//alert(pageWidth + ' ' + pageHeight); 

//return winSize; 
//alert(winSize); 

}




function showdiv()
        {
            getWinSize();
            document.getElementById("box").style.height=600+'px';
            document.getElementById("box").style.width=2000+'px';
           // alert("rong = "+pageWidth+"--cao = "+pageHeight);
           //alert(document.getElementById("wrapper").style.width);
            document.getElementById("box").style.visibility='visible';
            return true;
    }
    

