function PopupCenter(pageURL, title,w,h) {
    var left = (screen.width/2)-(w/2);
    var top = (screen.height/2)-(h/2);
    var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 


//-------------------------------------------------//
var oAjax = new ajaxObject();
var divName, currentProcess, curCusID, process;
var inProcess=false;
var inZipcode = false;
//var strDefault = document.getElementById('divZipcode').innerHTML;

oAjax.OnSuccess = function() {
    var div = document.getElementById(divName);
    var str_result = oAjax.GetResponseText();
    //document.getElementById('loading').style.display='none';
	//alert(str_result2010);
    switch(currentProcess)
    {
      case 'download': 	  	
	    div.innerHTML = str_result; 
         break;	     
    }   
}
    

oAjax.OnLoading = function() {    
   // document.getElementById('loading').style.display='block';   
}

oAjax.OnFailure = function() {
    alert("Please press F5 button if data loading causes problems.");
}
    
function download(filename){  	  	  	  
	  divName = "ajaxDownload";
      currentProcess = 'download';
      oAjax.InitXmlHttpRequest('GET', '?url=ajaxDownload&file='+filename);
      oAjax.Commit(null);   
}
function download2010(filename){
	//alert("bi loi roi");
	divName = "ajaxDownload2010";
	currentProcess = 'download2010';
	oAjax.InitXmlHttpRequest('GET', '?url=ajaxDownload2010&file='+filename);
	//alert(oAjax.InitXmlHttpRequest('GET', '?url=ajaxDownload2010&file='+filename));
	oAjax.Commit(null);   
}

function pDownload(){
	var tinhieu = true;
	name = document.getElementById('name').value;
	email = document.getElementById('email').value;
	// Check Email
	  if(document.getElementById('name').value==""){
	   alert("Please enter Your Name!"); 
	   document.getElementById('name').focus();
	   //tinhieu = false;
	   return false;
	  }
	  if(document.getElementById('email').value==""){
	   alert("Please enter Your Email!"); 
	   document.getElementById('email').focus();
	   //tinhieu = false;
	   return false;
	  }
	  var testresults
	  var str=document.getElementById('email').value
	  var filter=/^.+@.+\..{2,3}$/
	  if (filter.test(str)){
		  testresults=true
	  } else {
		  alert("Please enter a valid email address");
		  document.getElementById('email').focus();
		 //tinhieu = false;
		 return false;
	  }
}

