function GetObjectRef (ObjId) {
	if (document.getElementById) {
		return document.getElementById (ObjId);
	}
	else if (document.all) {
		return document.all[ObjId];
	}
	else {
		return null;
	}
}


function GetParentObjectRef (ObjId) {
	return GetObjectRef (ObjId.substring (3, ObjId.length));
}


function ChangeCase (thisSelect) {
	this.location.href = thisSelect.options[thisSelect.selectedIndex].value;
}


function ToggleMoreInfo (e) {
	var divMoreInfo = GetObjectRef ("DivMoreInfo");
	if (e.cancelBubble) {
		e.cancelBubble = true;
	}
	if (divMoreInfo != null) {
		if (divMoreInfo.style.display != "none") {
			divMoreInfo.style.display = "none";
		}
		else {
			divMoreInfo.style.display = "block";
			SetObjectOffset (divMoreInfo, e);
		}
	}
	return false;
}

function ToggleUserLogin (e) {
	var divUserLogin = GetObjectRef ("DivUserLogin");
	if (e.cancelBubble) {
		e.cancelBubble = true;
	}
	if (divUserLogin != null) {
		if (divUserLogin.style.display != "none") {
			divUserLogin.style.display = "none";
		}
		else {
			divUserLogin.style.display = "block";
			SetObjectOffset (divUserLogin, e);
		}
	}
	return false;
}

function SetObjectOffset (obj, e) {
	var bodyWidth = -1;
	if (document.body.clientWidth) {
		bodyWidth = document.body.clientWidth;
	}
	else if (window.innerWidth) {
		bodyWidth = window.innerWidth;
	}
	
	var offsetY = -1;
	if (obj.offsetHeight) {
		offsetY = obj.offsetHeight;
	}
	
	var offsetX = -1;
	if (obj.offsetWidth) {
		offsetX = obj.offsetWidth;
	}
	
	if (bodyWidth > -1 && offsetY > -1 && offsetX > -1) {
		// only use offset when we can obtain the bodyWidth and the offset
		var top = 0;
		var left = 0;
		if (e.pageX) {
			top = e.pageY - offsetY;
			left = e.pageX - offsetX;
		}
		else if (e.clientX) {
			var scrollTop = 0;
			if (document.body.scrollTop) {
				scrollTop = document.body.scrollTop;
			}
			top = e.clientY - offsetY + scrollTop;
			left = e.clientX - offsetX;
		}
		if (top < 0) {
			top = 0;
		}
		if (left < 0) {
			left = 0;
		}
		obj.style.top = top + "px";
		obj.style.left = left + "px";
	}
	
}


function ValidateContactForm (thisForm) {
	var reg = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
	  
	if (thisForm.Email.value == "") {
		alert ("You must put in your e-mail address.");
		thisForm.Email.focus();
		return false;
	}
	
	if (!reg.test(thisForm.Email.value)) {
		alert("Please enter a valid Email.");
		thisForm.Email.focus();
		return false ;
	}
	  
	return true;
}

function ValidateUserLogin (thisForm) {
	if (thisForm.Password.value == "") {
		alert ("You must put in your password.");
		return false;
	}
	return true;
}

function chkSpaces(frmName,fldName){
	nonspace = 0;
	temp = eval('document.' + frmName + '.' + fldName + '.value');
	if(temp != ""){
	
		NewArray = temp.split("\\")
		nonspace = 0
		count = NewArray.length - 1
		if(count > 0){ 
			fName = NewArray[count] 
		} else { 
			fName = temp 
		}
	
		for(i=0;i < fName.length;i++){
			if(fName.charAt(i) == " ")( nonspace = 1)
		}
	}
	
	if(nonspace == 1){
		alert('The name of the file that you are about to upload must not contain spaces. Please rename your file and try to upload it again.')
		return false;
	}
}

function _CF_onError(form_object, input_object, object_value, error_message)
    {
	alert(error_message);
       	return false;	
    }

function _CF_hasValue(obj, obj_type)
    {
    if (obj_type == "TEXT" || obj_type == "PASSWORD")
	{
    	if (obj.value.length == 0) 
      		return false;
    	else 
      		return true;
    	}
    else if (obj_type == "SELECT")
	{
        for (i=0; i < obj.length; i++)
	    	{
		if (obj.options[i].selected)
			return true;
		}

       	return false;	
	}
    else if (obj_type == "SINGLE_VALUE_RADIO" || obj_type == "SINGLE_VALUE_CHECKBOX")
	{

		if (obj.checked)
			return true;
		else
       		return false;	
	}
    else if (obj_type == "RADIO" || obj_type == "CHECKBOX")
	{

        for (i=0; i < obj.length; i++)
	    	{
		if (obj[i].checked)
			return true;
		}

       	return false;	
	}
	}

function  _CF_checkresume(_CF_this)

    {

    if  (!_CF_hasValue(_CF_this.INPNAME, "TEXT" )) 

        {

        if  (!_CF_onError(_CF_this, _CF_this.INPNAME, _CF_this.INPNAME.value, "We're sorry. You must enter your name. Thank you."))

            {

            return false; 

            }

        }

    if  (!_CF_hasValue(_CF_this.INPEMAIL, "TEXT" )) 

        {

        if  (!_CF_onError(_CF_this, _CF_this.INPEMAIL, _CF_this.INPEMAIL.value, "We're sorry. You must enter your email address. Thank you."))

            {

            return false; 

            }

        }

    return true;
}