 
 

function elementE(id){
	 return document.getElementById(id);
 }
 
 function showHide(id){
	if(element(id).style.display == 'block'){
		element(id).style.display='none'; }
		else { 
		element(id).style.display='block';
		}
	 
 }
  function showHide2(id,img){
	if(element(id).style.display == 'block'){
		element(id).style.display='none';
		element(img).src='images/plus.gif';
		}
		else { 
		element(id).style.display='block';
		element(img).src='images/min.gif';
		}
	 
 }
  function showHide3(id,img){
	if(element(id).className == 'exp'){
		element(id).className = 'contr';
		element(img).src='images/plus.gif';
		}
		else { 
		element(img).src='images/min.gif';
		element(id).className = 'exp';
		}
	 
 }
 
 
function popUp($url,w,h) {
	var rand = Math.random();
   mywindow = window.open($url,rand,"location=0,status=0,scrollbars=1,toolbar=0,menubar=0,titlebar=0,width=" + w + ",height=" + h + "");
  mywindow.moveTo(300,200);
 }
 function element(id){
	 return document.getElementById(id);
 }
 
 function checkCont(theform){
var error = "";
/*//*/
error += dropdown(theform.title,"Please choose your Title");
error += isBlank(theform.name.value,"Please enter your Name");
error += isBlank(theform.surname.value,"Please enter your Surname");
error += isBlank(theform.company.value,"Please enter your Company name");
error += isEmptyNum(theform.tel.value,"Please enter a valid Phone Number");
error += checkEmail(theform.email.value,"Please enter a valid Email Address");
error += isBlank(theform.country.value,"Please enter your Country.");
error += isBlank(theform.comments.value,"Please enter your Questions / Comments.");
error += dropdown(theform.Came_From,"Please indicate where you Heard about us.");
 
if(error != ""){ alert(error);return false; }  // else { return true; }
}



function checkWholeForm(theform){
var error = "";
/*//*/
error += dropdown(theform.title,"Please choose your Title");
error += isBlank(theform.name.value,"Please enter your Name");
error += isBlank(theform.surname.value,"Please enter your Surname");
error += isBlank(theform.company.value,"Please enter your Company name");
error += checkEmail(theform.email.value,"Please enter a valid Email Address");
error += isEmptyNum(theform.tel.value,"Please enter a valid Phone Number");
error += isBlank(theform.description.value,"Please tell us a little About your business.");
error += isBlank(theform.domain.value,"Please enter the Website Address.\n");
error += isBlank(theform.objectives.value,"Please tell us what you would like People to be able to do on the website.\n");
error += isBlank(theform.content.value,"Please tell us what Content / Information you would like on the site.\n");
error += dropdown(theform.Came_From,"Please indicate how you Heard about us.");

 
if(error != ""){ alert(error);return false; }  // else { return true; }
}



function ismaxlength(obj){

var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""

if (obj.getAttribute && obj.value.length>mlength)

obj.value=obj.value.substring(0,mlength)

}

 function http(field){
 field.value=field.value.replace('http://','');
 } function http(field){
 field.value=field.value.replace('http://','');
 }
 

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function isBlank(str,msg){
	var error = "";
	str = trim(str);
	if(str.length == 0){ error = msg +'\n'; }
	for (var i = 0; i <= str.length-1; i++){ /// all spaces?
		if(str.charAt(i) == " "){ error = msg +'\n';  } else {  error = "";
		}
	}
	return error;
	}

function fieldmatch(str1,str2,msg){
	var error = "";
	if(str1 != str2){
	error = msg +'\n';
	}
	return error;

}



function checkEmail (strng,msg) {
var error="";
	if (isBlank(strng)) { error = msg + "\n"; }
	
		var emailFilter=/^.+@.+\..{2,6}$/;
		if (!(emailFilter.test(strng))) { error = msg + "\n"; }
		else {
		   var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) { error = msg + "\n"; }
		}
	return error;    
}

function isEmptyNum(strng,msg) {
var error = "";
	if (isBlank(strng)) { error = msg + "\n"; } else {
		   var illegalChars= /[\@\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) { error = msg + "\n"; }
		}
	return error;	  
}
function valNum(strng,msg) {
var error = "";
	if(strng.length != 0){
		   var illegalChars= /[\@\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) { error = msg + "\n"; }
	}
	return error;	  
}


function radio(radiobut,strng){
var error = "";
var radio_choice = false;
for (i = 0; i < radiobut.length; i++){
if (radiobut[i].checked)
radio_choice = true; 
}
if (!radio_choice){ error = ""+strng+"\n"; }
return error; }

function dropdown(menu,strng){
var error = "";
 if ( menu.selectedIndex == 0 )
    {
        error = strng+" \n";
        valid = false;
    }
	return error; }
	


function toggleLayer(whichLayer){
if (document.getElementById) {
	// this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	style2.display = style2.display? "":"block";
}
else if (document.all){
	// this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	style2.display = style2.display? "":"block";
} else if (document.layers) {
	// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = style2.display? "":"block"; }
}

function dropother(menu,layer){
 if ( menu.selectedIndex == 1 ){
 	toggleLayer(layer); } else { 	
	if(document.getElementById(layer).style.display == "block"){
 	toggleLayer(layer); } }

} 


function clickIE4(){
if (event.button==2){
//alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
//alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("return false");





