var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;

function closew()
{
	document.getElementById("divTopRight").style.display='none'; 
}

function JSFX_FloatDiv(id, sx, sy)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	var px = document.layers ? "" : "px";
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

	el.floatIt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0) 
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.floatIt()", 40);
	}
	return el;
}
JSFX_FloatDiv("divTopRight", 10,30).floatIt();

function closeWin()
{
	//myWindow=window.open("","","width=200,height=100");
	window.close();
}


function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}
function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}

function validate_form(thisform)
{
with (thisform)
  {
 /* if (validate_required(name,"Name must be filled out!")==false)
  {name.focus();return false;}	  
  if (validate_required(question,"Question must be filled out!")==false)
  {question.focus();return false;}	*/
  if (validate_required(email,"Email must be filled out!")==false)
  {email.focus();return false;}	      
  if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}
  }
}
var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\!`\~\=\|1234567890]/;
function dodacheck(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mikExp) != -1) {
var tst = val.value.substring(0, (strLength) - 1);
val.value = tst;
   }
}
function doanothercheck(form) {
if(form.value.length < 1) {
alert("Please enter something.");
return false;
}
if(form.value.search(mikExp) == -1) {
alert("Correct Input");
return false;
}
else {
alert("Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n");
form.select();
form.focus();
return false;
}
alert("Correct Input");
return false;
}
function checkField(name) {
if (/[^a-z]/gi.test(name.value)) {
alert ("Only alpha characters are valid in this field"); // no spaces, full stops or anything but A-Z
which.value = "";
which.focus();
return false;
}
}


function validate_formnew(thisform)
{
with (thisform)
  {
  if (validate_required(name,"Name must be filled out!")==false)
  {name.focus();return false;}
  if (validate_required(phone,"Phone must be filled out!")==false)
  {phone.focus();return false;}
  if (validate_required(email,"Email must be filled out!")==false)
  {email.focus();return false;}	    	  
  if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}
  }
}

function isNumberKey(evt)
{
   var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
         return true;
}
