/* function for opening popup window */
function openpopup(url,popup_name,height,width,other_properties)
{
	var left		= parseInt((screen.width-350)/2);
	var top			= parseInt((screen.height-300)/2)	
	var win_options = 'height=550,width=580,resizable=yes,' 
	+ 'scrollbars=yes,left=' + left + ',top=' + top;
//	alert(toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=500');
	window.open(url,popup_name,win_options);
//	window.open(url);
}
function simplePreload()

{ 

  var args = simplePreload.arguments;

  document.imageArray = new Array(args.length);

  for(var i=0; i<args.length; i++)

  {

    document.imageArray[i] = new Image;

    document.imageArray[i].src = args[i];

  }

}
function checkDate(date_value)
{
	//valid format is DD/MM/YYYY
	
	var val_chk_dt = date_value.split("/");
	new_date = new Date(val_chk_dt[2],val_chk_dt[1]-1,val_chk_dt[0], 00, 00, 00);
	//var dateexpr =/^\([0-9][0-9]\)\\-\([0-9][0-9]\)\\-\([0-9]{4}\)/;
	//var dateexpr =/^\([0-9][0-9]\)\/\([0-9][0-9]\)\/\([0-9]{4}\)/; 

	if(new_date.getFullYear()!=val_chk_dt[2]||new_date.getDate()!=val_chk_dt[0]||new_date.getMonth()!=val_chk_dt[1]-1){
		alert("Please enter valid date in DD/MM/YYYY format!");
			return false;
	}	
	return true;

}
/// Tool Tips

function doTooltip(e, msg) {//alert(msg);
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ){ 
	return; 
  }
  Tooltip.show(e, msg);
}
function hideTip() {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.hide();
}

function IsInt(sText)
{
   var ValidChars = "0123456789";
   var IsInt=true;
   var Char;
   var sText1 = sText.value;
   //alert(sText+sText1);
   for (i = 0; i < sText1.length && IsInt == true; i++) 
   { 
      Char = sText1.charAt (i ); 
      if (ValidChars.indexOf(Char) == -1) 
      {
		 //alert("Enter Integer value.");
		 IsInt = false;
      }
   }
  // alert(IsInt);
   return IsInt;
}
function validateEmail(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}