function lightup(imageobject, opacity){
 if (navigator.appName.indexOf("Netscape")!=-1
  &&parseInt(navigator.appVersion)>=5)
    imageobject.style.MozOpacity=opacity/100
 else if (navigator.appName.indexOf("Microsoft")!= -1
  &&parseInt(navigator.appVersion)>=4)
    imageobject.filters.alpha.opacity=opacity
}
function change1(frm)
{
	document.getElementById("big").src=frm;
}
function hide1()
{
	document.getElementById("mo").style.display='none';
}

function valid_frm()
{
	if(document.login.username.value.search(/\S/)==-1)
	{
		alert("Please Enter Username");
		document.login.username.focus();
		return false;
	}
	if(!isEmail(document.login.username.value))
	{
		alert('Sorry! Invalid E-mail ID.');
		document.login.username.focus();
		return false;
	}
	if(document.login.userpass.value=="")
	{
		alert('Please Enter Password');
		document.login.userpass.focus();
		return false;
	}

}
function isEmail(s)
{
	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
	if (re.test(s) == true)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function valid()
{
	if(document.escortform.contactname.value.search(/\S/)==-1)
	{
		alert("Contact Name can not be empty");
		document.escortform.contactname.focus();
		return false;
	}


	if(document.escortform.contactemail.value.search(/\S/)==-1)
	{
		alert("Please Enter Username or Email");
		document.escortform.contactemail.focus();
		return false;
	}
	if(!isEmail(document.escortform.contactemail.value))
	{
		alert('Sorry! Invalid E-mail ID.');
		document.escortform.contactemail.value='';
		document.escortform.contactemail.focus();
		return false;
	}
	if(document.escortform.pass.value=="")
	{
		alert('Please Enter Password');
		document.escortform.pass.focus();
		return false;
	}
	var Phone=document.escortform.phone

	if ((Phone.value==null)||(Phone.value==""))
	{
		alert("Please Enter your Phone Number")
		Phone.focus()
		return false
	}
	if (checkInternationalPhone(Phone.value)==false)
	{
		alert("Please Enter a Valid Phone Number")
		Phone.value=""
		Phone.focus()
		return false
	}
	if(document.escortform.escortreviews.value=='')
	{
		alert("Please Give Information");
		document.escortform.escortreviews.focus();
		return false;

	}
	if(document.escortform.nationality.selectedIndex==0)
	{
		alert('Please Select Nationality');
		return false;
	}
	if(document.escortform.age.selectedIndex==0)
	{
		alert('Please Select Age');
		return false;
	}
	document.getElementById('center').style.display = 'none';
	document.getElementById('uploading').style.display = 'block';
}

var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(x)
{   var i;
    for (i = 0; i < x.length; i++)
    {
        // Check that current character is number.
        var c = x.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(x, 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 < x.length; i++)
    {
        // Check that current character isnt whitespace.
        var c = x.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
	x=stripCharsInBag(strPhone,validWorldPhoneChars);
	return (isInteger(x) && x.length >= minDigitsInIPhoneNumber);
}

