// JavaScript Document
Busy=function(Really){
   if(Really){
    document.body.style.cursor="wait";	
   }else{
    document.body.style.cursor="default";	
   }
}
// blank check
IsBlank=function (object){
 //if(object.type=="text"){
  if(object.value.search(/\S/)==-1){
   return true;
  }
  
  return false;
 //}
}
// email format check
IsEmail=function (object){
  if((/^[\w-\.]+\@[\w\.-]+\.[a-z]{2,4}$/.test(object.value))){
	return true;  
  }	else{
	return false;  
  }
}

CreateFormIndentifier=function(form){ 
	if(form.uniqkey==undefined){
		CreateFormElement(form,"uniqkey");  
	}   
	key=Math.round(Math.random()*100);  
	form.uniqkey.value=new Date().getTime() + "" +key;   	
}

CreateFormElement=function(Form,Ename){
	formInput = null;
	formInput = document.createElement('input');
	formInput.setAttribute('type', 'hidden');
	formInput.setAttribute('name', Ename);
	formInput.setAttribute('id', Ename);
	formInput.setAttribute('value', '');
	Form.appendChild(formInput);
}

PopUp=function(url,height,width){   
  if(screen.availHeight && screen.availWidth){
    var ah=screen.availHeight-30;
    var aw=screen.availWidth-10;
  }else{
	var ah=708; 
	var aw=1014;	
  }  
  if(height==undefined){	
    height=600;
  }
  if(width==undefined){	
    width=700;
  }  
		
  var xc = (aw - 500) / 2;
  var yc = (ah - 500) / 2;
  
  var winProp='toolbar=0, menubar=0, resizable=1, scrollbars=1, dependent=0, status=0,';      
      winProp+=' width='+width+', height='+height+',left=' + xc + ', top=' + yc;
  	
    
  var new_window = window.open(url, 'new_window', winProp);
  if(new_window && new_window.focus){
    new_window.focus();
  }
}

CountChecked=function(name,form){
  var cntchk=0;
  for(var i=0;i<form.elements.length;i++){
    if(form.elements[i].name==name && form.elements[i].checked==true){    
   	  cntchk++;
    }
  }  
  return cntchk;
}