	var exp = new Date();
	exp.setTime(exp.getTime() + 1 * 24 * 3600 * 1000);
	
	function storePropID(pID)
	{ 
		//'alert( "Hello" );
		var cVal = GetCookie('propIDs');
		if( cVal == null ) 
		{
			SetCookie ('propIDs', pID, exp);
			alert( "Added Property To Brochure" );
		} 
		else
		{
			dupe = false;
			if( cVal.indexOf( "," ) == -1 && cVal == pID ) //' just 1 entry so far
				dupe = true;
			else
			{
				arr = cVal.split( "," );
				for( i = 0; i <= arr.length; i ++ ){
					if( arr[i] == pID ) //' already added this property
					{
						dupe = true;
					}
				}
			}
			if( !dupe )
			{
				cVal += ","+pID;
				SetCookie ('propIDs', cVal, exp);
				alert( "Added Property To Brochure" );
			}
			else
				alert( "That property has already been added" );
		}
		
		return;
	} 
	
	//' return all property IDs to be added to the brochure
	function getPropID()
	{ 
		var propIDs = GetCookie('propIDs');
		return( propIDs );
	} 
	
	function GetCookie (name) {  
		alert( "Get Cookie" );
		var arg = name + "=";  
		var alen = arg.length;  
		var clen = document.cookie.length;  
		var i = 0;  
		while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
		}  
		return null;
	}
	
	function SetCookie (name, value) {  
		alert( "Set Cookie" );
		var argv = SetCookie.arguments;  
		var argc = SetCookie.arguments.length;  
		var expires = (argc > 2) ? argv[2] : null;  
		var path = (argc > 3) ? argv[3] : null;  
		var domain = (argc > 4) ? argv[4] : null;  
		var secure = (argc > 5) ? argv[5] : false;  
		alert( "Path = '"+path+"'" );
		document.cookie = name + "=" + escape (value) + 
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
		((path == null) ? "" : ("; path=" + path)) +  
		((domain == null) ? "" : ("; domain=" + domain)) +    
		((secure == true) ? "; secure" : "");
	}
	
	function getCookieVal (offset) {  
		var endstr = document.cookie.indexOf (";", offset);  
		if (endstr == -1)    
		endstr = document.cookie.length;  
		return unescape(document.cookie.substring(offset, endstr));
	}
	
	function DeleteCookie (name) {  
		alert( "Del Cookie" );
		var exp = new Date();  
		exp.setTime (exp.getTime() - 1);  
		var cval = GetCookie (name);  
		document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
	}

	//' check if a property has already been added to the brochure
	function checkBrochure()
	{
		var contents = GetCookie('propIDs');
		
		if( contents == null ) //' if no properties added to brochure yet
			return;
		else
		{
			/*idArr = contents.split( "," );
			for( i=0; i<idArr.length; i++ )
			{
				
				idStr = eval( "document.getElementById('bButt"+idArr[i]+"').value" );
				formStr = eval( "document.myform.bButt"+idArr[i]+".value" );
				htmlStr = eval( "document.myform.bButt"+idArr[i]+".outerHTML" );
				replaceStr = eval( "document.myform.bButt"+idArr[i]+".outerHTML.value" );
				//'alert( "outerHTML = '"+htmlStr+"'" );
				temp = new String( htmlStr );
				temp = htmlStr.replace( "Add To Brochure", "Remove" );
				replaceStr = temp;
				//'alert( "outerHTML-After = '"+htmlStr+"'" );
				
				//alert( "idStr = '"+idStr+"'" );
				//alert( "formStr = '"+formStr+"'" );
				if( idStr == "Add To Brochure" )
					formStr = "Remove";
					
			}
			return;
			*/
		}
	}
	
	//' redirect to a php file to create this brochure using idArr
	function makeBrochure()
	{
		var contents = GetCookie('propIDs');
		if( contents == null ) 
		{
			alert( "Sorry, You have not selected any properties yet!" );
		}
		else
		{
			var idArr = getPropID();
			document.location.href='admin/makeBrochure.php?idArr='+idArr;		
		}
	}

	
	function openUpload( propID, sortOrder )
	{
		if( sortOrder != "" && sortOrder != "undefined" )
			window.open( '../fileupload/upload.php?propID='+propID+'&sortOrder='+sortOrder, 'PROPERTYIMAGEUPLOAD', 'scrollbars=yes, menubar=no, resize=yes, status=no, location=no, toolbar=no, top=20, left=100, width=350, height=350' );
		else
			window.open( '../fileupload/upload.php?propID='+propID, 'PROPERTYIMAGEUPLOAD', 'scrollbars=yes, menubar=no, resize=yes, status=no, location=no, toolbar=no, top=20, left=100, width=350, height=350' );
		return;
	}
	
	function checkSearch()
	{
		if( document.propSearch.type.options[document.propSearch.type.selectedIndex].value == "" && document.propSearch.status.options[document.propSearch.status.selectedIndex].value == "" && document.propSearch.beds.options[document.propSearch.beds.selectedIndex].value == "" )
		{
			alert( "Please select at least one search criterion." );
			return false;
		}
		else
			return true;
	}
	
	


function checkDets( form )
{
	var nameOk  = nameCheck( form.uName.value );
	var emailOk = emailCheck( form.email.value );
	if( emailOk && nameOk )
		return true;
	return false;
}

function emailCheck( str ) 
{
   if((str.indexOf(".") > 2) && (str.indexOf("@") > 0))
   		return true;
   else
   {
	   alert( "Invalid email address" );
	   return false;
   }
   
   	
}



function nameCheck( name )
{
	var name = new String( name );
	//'if( name.length > 0 && Defined( name ) )
	if( name.length > 0 )
		return true;
	else
	{
		alert( "Please enter your name" );
		return false;
	}
}

/*
function Defined( val )
{
	return( val+''="undefined" );
}
*/

