/*
CSS Browser Selector v0.2.7
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
var css_browser_selector = function() {var ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t) != -1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js'; h.className += h.className?' '+c:c;}();
//
var re = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/;
var blank=" ";
getLayer('Yournumber').value="0";
function New_Form1_Validator(theForm)
{  
//  
if(checkOthers(theForm)) return (true);
  return (false);
}
//
function switchVisibleALL()
{
// 	alert("at switchVisibleALL")
 	switchVisible('YourFirstNamex',1);
 	switchVisible('YourLastNamex',1);
 	switchVisible('YourEMailx',1);
 	switchVisible('Yournumberx',1);
}
//
function createPhoneNum()
{
	var num=getLayer('first').value + getLayer('second').value + getLayer('third').value;
		var validPhone = re.exec(num);
			if (validPhone) 
			{
				num = "(" + validPhone[1] + ") " + validPhone[2] + "-" + validPhone[3];
				getLayer('Yournumber').value=num;
			}
			else 
			{
				alert(num + " isn't a valid phone number");
				getLayer('first').focus();
				getLayer('first').select();
			}
//	alert("debug pmh contact: phone number="+getLayer('Yournumber').value+ "   area="+n1+"   prefix="+ n2+ "   num="+n3);
}
//
function checkOthers(theForm)
{
	
	var stuff=theForm.CommentsQuestions.value;
	if (stuff == '')
	{
		theForm.CommentsQuestions.value="No comments given";
	}
	return (true);
}       
/////////////
// Utilities
/////////////
///
//check phone number
///
function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
//
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
//
function checkInternationalPhone(strPhone)//DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
{
	s=stripCharsInBag(strPhone,validWorldPhoneChars);
	return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
//
function autotab(original)
{
//	var destination;
	//var b=original.value.length;
	//var c=original.getAttribute("maxlength");
	var d=original.getAttribute("name");
	//alert("debug pmh autotab: original.value.length="+ b  +"   original.getAttribute(maxlength)="+c+"  name="+d);
	if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
		{
			if(d=="first")getLayer('second').focus();
			else if(d=="second")getLayer('third').focus();
			else return;
		}
}