function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function nonstop()
	{
	if (document.FlightSearch.FNonStop.checked==false)
	{
	document.FlightSearch.FNonStop.value=0;
	document.FlightSearch.NStop.value=0;
	
		//alert(document.FlightSearch.FNonStop.value);NStop
	}
	else
	{
	document.FlightSearch.FNonStop.value=1;
	document.FlightSearch.NStop.value=1;
	//alert(document.FlightSearch.FNonStop.value);
	}
}	
function validate(){
	if(document.getElementById("requiredEmail").value=="")
	{
	alert("Please enter your E-mail address.")
	document.getElementById("requiredEmail").focus()
	return false
	}
	else if(document.getElementById("requiredEmail").value.indexOf("@")==-1)
	{
	alert("Email address seems incorrect (check @ and .'s)")
	document.getElementById("requiredEmail").focus()
	document.getElementById("requiredEmail").select()
	return false
	}
	else if(document.getElementById("requiredEmail").value.indexOf(".")==-1)
	{
	alert("Email address seems incorrect (check @ and .'s)")
	document.getElementById("requiredEmail").focus()
	document.getElementById("requiredEmail").select()
	return false
	}
				}
function emailChk (emailStr) 
{
var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
alert("Email address seems incorrect (check @ and .'s)");
document.getElementById("requiredEmail").focus();
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
document.getElementById("requiredEmail").focus();
return false;
   }
}
for (i=0; i<domain.length; i++)
 {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
document.getElementById("requiredEmail").focus();
return false;
   }
}
if (user.match(userPat)==null) {
alert("The username doesn't seem to be valid.");
document.getElementById("requiredEmail").focus();
return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
document.getElementById("requiredEmail").focus();
return false;
   }
}
return true;
}
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
document.getElementById("requiredEmail").focus();
return false;
   }
}
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
document.getElementById("requiredEmail").focus();
return false;
}
if (len<2) {
alert("This address is missing a hostname!");
document.getElementById("requiredEmail").focus();
return false;
}
return true;
}
//  End -->
function remove_XS_whitespace(item)
{
  var tmp = "";
  var item_length = item.value.length;
  var item_length_minus_1 = item.value.length - 1;
  for (index = 0; index < item_length; index++)
  {
    if (item.value.charAt(index) != ' ')
    {
      tmp += item.value.charAt(index);
    }
    else
    {
      if (tmp.length > 0)
      {
        if (item.value.charAt(index+1) != ' ' && index != item_length_minus_1)
        {
          tmp += item.value.charAt(index);
        }
      }
    }
  }
  item.value = tmp;
}
function checkreq(which) 
{
	if(emailChk(document.getElementById("requiredEmail").value))
	{
		window.open('','Dnewsthanks','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,height=150,width=449');
		return true;
	}
	else
	{
		return false;
	}
}

	function clickr()
{
	document.getElementById("requiredEmail").value=" "; 
}
		function changePicture_New(num)
	{
		if(num==0)
			{
				document.getElementById("flthtlbutton").setAttribute("src","images/flight-and-hotel1.jpg"); 
				document.getElementById("fltbutton").setAttribute("src","images/flight-only2.jpg"); 
				document.getElementById("htlbutton").setAttribute("src","images/hotel-only2.jpg"); 
				
			}
			if(num==1)
			{
				
				document.getElementById("fltbutton").setAttribute("src","images/flight-only1.jpg"); 
				document.getElementById("flthtlbutton").setAttribute("src","images/flight-and-hotel2.jpg"); 
				document.getElementById("htlbutton").setAttribute("src","images/hotel-only2.jpg"); 
			}
			if(num==2)
			{
				document.getElementById("htlbutton").setAttribute("src","images/hotel-only1.jpg"); 
				document.getElementById("flthtlbutton").setAttribute("src","images/flight-and-hotel2.jpg"); 
				document.getElementById("fltbutton").setAttribute("src","images/flight-only2.jpg"); 
				
			}
			
	}
