function openURL()
{ 

// grab index number of the selected option
selInd = document.quicklinks.links.selectedIndex; 

// get value of the selected option
goURL = document.quicklinks.links.options[selInd].value;

// redirect browser to the grabbed value (hopefully a URL)
top.location.href = goURL; 

}

function awards_popper ()
{

window.open("awards_popup.html","awards_window","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=1,width=565,height=305,innerWidth=565,innerHeight=305,top=180,left=200");

}

function agent_popper ()
{

window.open("our_agents_popup.html","agent_window","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=1,width=565,height=468,innerWidth=565,innerHeight=468,top=180,left=200");

}

function mlssignup()

{

DispWin1=window.open('http://mlsplug-in.com/mlsplugin/signup.asp?Office=24','a','width=772,height=800 scrollbars=1,resizable=1,toolbar=1,menubar=0');

}

function buyrequestform ()
{

 window.open("buyerrequest.php","buyrequest","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=1,width=750,height=550,innerWidth=707,innerHeight=550,top=50,left=209;");

}

function salesrequestform ()
{

 window.open("property_sale_requestform.php","sellrentrequest","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=1,width=750,height=550,innerWidth=707,innerHeight=550,top=50,left=209;");

}

function rentalrequestform ()
{

 window.open("property_rental_requestform.php","sellrentrequest","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=1,width=750,height=550,innerWidth=707,innerHeight=550,top=50,left=209;");

}

function salerentalrequestform ()
{

 window.open("sale_rental_request.php","sellrentrequest","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=1,width=750,height=550,innerWidth=707,innerHeight=550,top=50,left=209;");

}

function resubmit_data(dat,k)
{
  document.return_form.sort.value=dat;
    document.return_form.pageStart.value=k;
//  alert(document.return_form.sort.value);
//  document.return_form.list_id.value=list_id_val;
  document.return_form.submit();
  return false;
}

function trim(inputString) 
	{
		if (typeof inputString != "string") 
		{
			return inputString; 
		}
		var retValue = inputString;
		var ch = retValue.substring(0, 1);
		while (ch == " ") 
		{ // Check for spaces at the beginning of the string
			retValue = retValue.substring(1, retValue.length);
			ch = retValue.substring(0, 1);
		}
		ch = retValue.substring(retValue.length-1, retValue.length);
		while (ch == " ") 
		{ // Check for spaces at the end of the string
			retValue = retValue.substring(0, retValue.length-1);
			ch = retValue.substring(retValue.length-1, retValue.length);
		}
		//while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
		//retValue = retVal
	//}
	return retValue;
	}

	function isValidEmail(emstr)
	{
		var vEMailID=emstr
		var atPos= vEMailID.indexOf("@") + 1
		var lastDotPos= vEMailID.lastIndexOf(".") + 1
		var firstDotPos = vEMailID.indexOf(".") + 1
		var atInstances=0
		var dotInstances=0
		var inValid = new Array()
		var errorMessages = new Array()
		var errNo = 0
			
		for(var i=0;i<vEMailID.length;i++)		
		{
			if(vEMailID.charAt(i)=="@" )
			   atInstances+=1
			else if(vEMailID.charAt(i)==".")
			   dotInstances=1
		}

		inValid[errNo] = (atInstances==0)
		errorMessages[errNo] = "@ symbol is missing"
		errNo++

		inValid[errNo] = (dotInstances==0)
		errorMessages[errNo] = ". symbol is missing"
		errNo++

		inValid[errNo] = (atInstances>1)
		errorMessages[errNo] = "@ symbol should not repeat"
		errNo++

		inValid[errNo] = (Math.abs(firstDotPos-atPos)==1)
		errorMessages[errNo] = "@ and . symbols can't come together"
		errNo++

		inValid[errNo] = ((lastDotPos-atPos)<=1)
		errorMessages[errNo] = ". symbol is missing"
		errNo++

		inValid[errNo] = (atPos==vEMailID.length)
		errorMessages[errNo] = "@ symbol can't appear at end"
		errNo++

		inValid[errNo] = (lastDotPos==vEMailID.length)
		errorMessages[errNo] = ". symbol can't appear at end"
		errNo++

		inValid[errNo] = (atPos==0)
		errorMessages[errNo] = "@ symbol is missing"
		errNo++

		inValid[errNo] = (atPos==1)
		errorMessages[errNo] = "@ symbol should not appear at first position"
		errNo++

		inValid[errNo] = (firstDotPos==0)
		errorMessages[errNo] = ". symbol is missing"
		errNo++

		inValid[errNo] = (firstDotPos==1)
		errorMessages[errNo] = ". symbol should not appear at first position"
		errNo++

		inValid[errNo] = (vEMailID.indexOf(" ")>=0)
		errorMessages[errNo] = "E-mail can't contain blank spaces."
		errNo++

		inValid[errNo] = (vEMailID.indexOf("/")>=0) || (vEMailID.indexOf("\\")>=0)
		errorMessages[errNo] = "E-mail can't contain \\ or /"
		errNo++

		var fullErrorMessage = "Invalid " + name + " email address.\n"
		for(var ind=0; ind<errNo; ind++)
		{
			if(inValid[ind])
			{
				fullErrorMessage += errorMessages[ind] + "\n"
				alert(fullErrorMessage)			
				return false
			}
		}
			var SingleQuotePos = vEMailID.indexOf("'") 
			if(SingleQuotePos!=-1)
			{
						alert("Enter valid characters.Single Quotes ( ' ) are not allowed.")					
						return false

			} 
		return true;
	}
	
	
	
	function validate()
	{
	
 
	
		if(trim(document.myform.username.value)=="")
			{
				alert("Please fill the value of First Name ")
				document.myform.username.focus();
				return false;
			}
			
		 
			
			
			
		if(trim(document.myform.phone.value)=="")
		{
			alert("Please fill the value of phone ")
			document.myform.phone.focus();
			return false;
		}
		
		phoneval=trim(document.myform.phone.value);
		phonevallen=phoneval.length;
		if((phonevallen < 10) || (phonevallen > 10) || (isNaN(phoneval)))
		{
		  	alert("Please check phone number should be a 10 digit and should not contain text ")
			document.myform.phone.focus();
			return false;
		
		}	
		
		
		
		if(trim(document.myform.email.value)=="")
		{
			alert("Please fill the value of email ")
			document.myform.email.focus();
			return false;
		}
		else
		{
			if(!isValidEmail(trim(document.myform.email.value)))
			{
				document.myform.email.focus();
				return false;	
			}
		}
		
  }		

 function call_gall(a,b)
	{
		window.open("application/gallery.php?list_id="+a+"&login="+b,"name","width=825,height=414,resizable=no,scrollbars=yes,top=50,left=50");
	}
	
function open_print(a)
	{
		window.open(a,"name","width=825,height=610,resizable=no,scrollbars=yes,top=50,left=50");
	}
	
function handleMap(url){
		window.open(url,'map');
	}
	
function ViewFloorPlan(url,w,h)
{
url="../"+url;

if(h>300 || w>300)
{
//alert(h+":"+w);
	h=h+120;
	//w=w+100;
	w=w+320;
//	alert(h+":"+w);
}else
{
 
    h=420;
	w=w+490;
}
 

 
//alert("height="+h+",width="+w+",status=yes,scrollbars=no,toolbar=no,menubar=no,location=no,top=3")
window.open("application/large_pic.php?a="+url,"ur","height="+h+",width="+w+",status=yes,resize=yes,scrollbars=no,toolbar=no,menubar=no,location=no,top=3"); 
}

function popup_data()
{
window.open("application/bus_dist_to.php","Photomanager","status=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=1,width=580,height=550,innerWidth=560,innerHeight=350,top=50,left=209;");

}



