// JavaScript Document
function openPopUp(url, i_hi, i_wi, i_top) {
	i_screenWidth = screen.width;
	i_screenHeight = screen.height;
	if((i_hi == '') || (i_hi == 0) || (i_hi == 'undefined')) {
		i_winHeight = 570;
	}
	else {
		i_winHeight = i_hi;
	}	
	if((i_wi == '') || (i_wi == 0) || (i_wi == 'undefined')) {
		i_winWidth = 770;
	}
	else {
		i_winWidth = i_wi;
	}	
	if((i_top == '') || (i_top == 0) || (i_top == 'undefined')) {
		i_top = 1;
	}
	else {
		i_top = i_top;
	}	
	i_left = (i_screenWidth-i_winWidth)/2;				
	w_child = window.open(url, "_blank", "scrollbars,height=" + i_winHeight + ",width=" + i_winWidth + ",top=" + i_top + ",left=" + i_left + ",resizable=1");
	//w_child.focus;
	return;
}
function setBrowserValue(){
	var nVer = navigator.appVersion;
	var nAgt = navigator.userAgent;
	var browserName  = navigator.appName;
	var fullVersion  = ''+parseFloat(navigator.appVersion); 
	var majorVersion = parseInt(navigator.appVersion,10);
	var nameOffset,verOffset,ix;
	
	// In MSIE, the true version is after "MSIE" in userAgent
	if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
	 browserName = "Microsoft Internet Explorer";
	 fullVersion = nAgt.substring(verOffset+5);
	}
	// In Opera, the true version is after "Opera" 
	else if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
	 browserName = "Opera";
	 fullVersion = nAgt.substring(verOffset+6);
	}
	// In Chrome, the true version is after "Chrome" 
	else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
	 browserName = "Chrome";
	 fullVersion = nAgt.substring(verOffset+7);
	}
	// In Safari, the true version is after "Safari" 
	else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
	 browserName = "Safari";
	 fullVersion = nAgt.substring(verOffset+7);
	}
	// In Firefox, the true version is after "Firefox" 
	else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
	 browserName = "Firefox";
	 fullVersion = nAgt.substring(verOffset+8);
	}
	// In most other browsers, "name/version" is at the end of userAgent 
	else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) ) 
	{
	 browserName = nAgt.substring(nameOffset,verOffset);
	 fullVersion = nAgt.substring(verOffset+1);
	 if (browserName.toLowerCase()==browserName.toUpperCase()) {
	  browserName = navigator.appName;
	 }
	}
	// trim the fullVersion string at semicolon/space if present
	if ((ix=fullVersion.indexOf(";"))!=-1) fullVersion=fullVersion.substring(0,ix);
	if ((ix=fullVersion.indexOf(" "))!=-1) fullVersion=fullVersion.substring(0,ix);
	
	majorVersion = parseInt(''+fullVersion,10);
	if (isNaN(majorVersion)) {
	 fullVersion  = ''+parseFloat(navigator.appVersion); 
	 majorVersion = parseInt(navigator.appVersion,10);
	}
	
	document.getElementById("B_rowser").innerHTML = browserName + '&nbsp;' +fullVersion;
	
	//document.write('<br />Javascript Fn returning: <br><br />');
	//document.write('Browser name  = '+browserName+'<br>');
	//document.write('Full version  = '+fullVersion+'<br>');
	//document.write('Major version = '+majorVersion+'<br>');
	//document.write('navigator.appName = '+navigator.appName+'<br>');
	//document.write('navigator.userAgent = '+navigator.userAgent+'<br>');
	//WRITE THE BROWSER NAME TO THE SUBMIT FORM HIDDEN VALUE
	if(document.frm_submit){
		
			document.frm_submit.client_browser.value = browserName + ' ' + fullVersion;
		
	}
}

function checkemail(str){
	//alert(str);
	//var Cleaned_str = removeSpecialChar(str);
	//alert(Cleaned_str);
	//var str=document.validation.emailcheck.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	//var filter=/^[a-zA-Z]+([_\.-]?[a-zA-Z0-9]+)*@[a-zA-Z0-9]+([\.-]?[a-zA-Z0-9]+)*(\.[a-zA-Z]{2,4})+$/
	//var filter=/^[a-zA-Z0-9.][a-zA-Z0-9-_\s]+@[a-zA-Z0-9-\s].+\.[a-zA-Z]{2,5}$/
	if (filter.test(str)){
		testresults=true;
	}
	else{
	
		testresults=false;
	}
	return testresults;
}
function removeSpecialChar(str) {
    
	return str.replace(/[\(\)\~\-\s,]/g, "");
	
}

function IsNumeric(t_string) {
   var t_validChars = "0123456789.,";
   var b_num = true;
   var c_char;
 
   for (i = 0; i < t_string.length && b_num == true; i++) { 
      c_char = t_string.charAt(i); 
      if (t_validChars.indexOf(c_char) == -1) {
         b_num = false;
      }
   }
   return b_num;   
}

function validate(){
	var b_Valid, t_Error, f_form;
	b_Valid = true;
	t_Error = "";
	f_form = document.frm_submit;
	
	//Contact Name
	if (f_form.contact_name.value == ""){
		b_Valid = false;
		t_Error = t_Error + "Please enter a contact name!. \n";
		
	}
	
	//Email
	if(f_form.contact_email.value == ""){
		t_Error = t_Error + "Please enter an e-mail address!\n";
		b_valid = false;
	}
	else{
		if(checkemail(f_form.contact_email.value) == false){
			t_Error = t_Error + "Invalid email address.\n";
			b_valid = false;
		}
	}
	/*//Phone contact_phone
	if (f_form.contact_phone.value == ""){
		b_Valid = false;
		t_Error = t_Error + "Please enter a phone number!. \n";
		
	}*/
	
	//Desc problem_description
	if (f_form.problem_description.value == ""){
		b_Valid = false;
		t_Error = t_Error + "Please enter a short problem description!. \n";
		
	}
	
	if(b_Valid == false){
		alert(t_Error);
	}
	return b_Valid;

}
//function for the expand/collapse list of contacts under loc
function toggle(box,fontId,whichRow) {
 	//box is the id of the DIV tag
	//fontId is the id of the font tag
	//whichRow is the subscript of the repeating row
	var whichSign, plusSign, minusSign;
 	//whichSign is what the font tag is set to, it is a + to start with 
	whichSign = (document.getElementById(fontId + whichRow).innerHTML);
  	plusSign = '+'
	minusSign = '-'
	if (whichSign == '+'){
	//the default style of the DIV is set to none, reset that to block(which shows the DIV contents)
		if ((document.getElementById(box).style.display)=='none'){
			(document.getElementById(box).style.display) = "block";
		}
		//change the sign to minus when plus is cliked and change the display style of the DIV 
		document.getElementById(fontId + whichRow).innerHTML = minusSign;
		document.getElementById(box).style.display = "block";
	}
	else if (whichSign == '-'){
		document.getElementById(fontId + whichRow).innerHTML = plusSign;
		document.getElementById(box).style.display = "none";
	}
}

<!--
/*function checkOS() {
  if(navigator.userAgent.indexOf('IRIX') != -1)
    { var OpSys = "Irix"; }
  else if((navigator.userAgent.indexOf('Win') != -1) &&
  (navigator.userAgent.indexOf('95') != -1))
    { var OpSys = "Windows95"; }
  else if(navigator.userAgent.indexOf('Win') != -1)
    { var OpSys = "Windows3.1 or NT"; }
  else if(navigator.userAgent.indexOf('Mac') != -1)
    { var OpSys = "Macintosh"; }
  else { var OpSys = "other"; }
  return OpSys;
}*/
// -->