$(document).ready(function(){
		$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 4000, true);
	});
// open show-map-popup.php form in dhtml page (Created By Bhavin Bhatt)
function openmappopupform(PropertyId){


	document.cookie = 'ppkcookie9=' + PropertyId +'; expires=Fri, 3 Aug 2007 20:47:11 UTC; path=/';

	//alert(document.cookie);
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', '/show-map-popup.php?PropertyId='+PropertyId+'&street_view=streetview&width=630px&height=425px&page=home', 'View On Map', 'width=633px,height=430px,left=190,center=1,resize=0,scrolling=0')

emailwindow.onclose=function(){ //Define custom code to run when window is closed
	var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
	var theemail=this.contentDoc.getElementById("emailfield") //Access form field with id="emailfield" inside iframe
	if (theemail.value.indexOf("@")==-1){ //crude check for invalid email
		alert("Please enter a valid email address")
		return false //cancel closing of modal window
	}
	else{ //else if this is a valid email
		document.getElementById("youremail").innerHTML=theemail.value //Assign the email to a span on the page
		return true //allow closing of window
	}
}
} //End "openmappopupform" function


// open Map Search window in dhtml page and others related pages

function openMapSearch0(){


	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'map_search.html', 'Map Search', 'width=700px,height=550px,left=190,center=1,resize=0,scrolling=0')

}
// open favourites page
function openMapSearch1(){


	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'favourites.html', 'Favorites', 'width=700px,height=550px,left=190,center=1,resize=0,scrolling=0')

}
function openMapSearch2(){


	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'report_your_lease1.php', 'Report Your Lease', 'width=700px,height=355px,left=190,center=1,resize=0,scrolling=0')

}
function openMapSearch3(){


	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'search_tips.html', 'Search Tips', 'width=700px,height=550px,left=190,center=1,resize=0,scrolling=0')

}
function openMapSearch4(){


	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'keyword_serach.html', 'Keyword Search', 'width=700px,height=495px,left=190,center=1,resize=0,scrolling=0')

}
function openMapSearch5(){


	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'image_galery.html', 'Image Gallery', 'width=700px,height=550px,left=190,center=1,resize=0,scrolling=0')

}

window.onload = function () {
	//document.FrmAdminLogin.Uname.focus();
	document.searchsmall.searchString.focus();
}



function ValidateLogin(){

	function trim(Value)
{
	return Value.replace(/^\s+|\s+$/g, "");
}


	var iChars = "!#$%^&*()+=-[]\\\';,/{}|\":<>?";

	if(trim(document.FrmAdminLogin.Uname.value)=='')
	{
		//alert('Enter User Name');
		hideloginerror();
		document.getElementById("usernameError").style.display = "inline";

		document.FrmAdminLogin.Uname.focus();
		return  false;
	}
	else {
		hideloginerror();

		var firstnamelength=document.FrmAdminLogin.Uname.value;
		  var firstlen = firstnamelength.length;
			if((firstlen < 3) | (firstlen > 250))
			{
				//alert('Password must be six character long');
				document.getElementById("usernameLenError").style.display = "inline";

				document.FrmAdminLogin.Uname.focus();
				return  false;
			}
	}
    var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	if(document.FrmAdminLogin.Pass.value == '')
	{
		//alert('Enter Password');
		hideloginerror();
		document.getElementById("passwordError").style.display = "inline";

		document.FrmAdminLogin.Pass.focus();
		return  false;
	}
	else {
		hideloginerror();
		 var firstnamelength=document.FrmAdminLogin.Pass.value;

		var firstnamelength=document.FrmAdminLogin.Pass.value;
		  var firstlen = firstnamelength.length;
			if((firstlen < 6) | (firstlen > 25))
			{
				//alert('Password must be six character long');
				document.getElementById("passwordLenError").style.display = "inline";

				document.FrmAdminLogin.Pass.focus();
				return  false;
			}
	}

	return true;
}
function hideloginerror() {
	document.getElementById("usernameError").style.display = "none";
	document.getElementById("usernameNoError").style.display = "none";
	document.getElementById("usernameLenError").style.display = "none";
	document.getElementById("passwordError").style.display = "none";
	document.getElementById("passwordNoError").style.display = "none";
	document.getElementById("passwordLenError").style.display = "none";
}

var x;
		var a= new Array();
		a[0] = 'images/map_img.jpg';
		a[1] = 'images/favourites_img.jpg';
		a[2] = 'images/report_img.jpg';
		a[3] = 'images/search_tips_home.jpg';
		a[4] = 'images/keyword_search_home.jpg';
		a[5] = 'images/images_galery_home.jpg';

		var b= new Array();
		b[0] = 'Map Search';
		b[1] = 'Favorites';
		b[2] = 'Report Your lease';
		b[3] = 'Search Tips';
		b[4] = 'Keyword Search';
		b[5] = 'Image Gallery';


		//a[6] = 7;



		test1(4, 'SubmitNext','SubmitPrev');


		function popup1(ID)
		{
			IMG = document.getElementById(ID).src;

			arrayImg = IMG.split('/');
			ImgStr = arrayImg[arrayImg.length-1];

			var finalInt = 0;


			for(i=0;i<=arrayImg.length;i++) {

				arrayStr = a[i].split('/');
				if(arrayStr[arrayStr.length-1] == ImgStr) {
					finalInt = i;
					Fun = "openMapSearch"+i+"()";
					eval(Fun);
				}
			}


			//IMG = document.getElementById(ID).src;
			//alert(IMG);
		}

		function test1(total, IDNxt, IDPrev)
		{
			x=0;
			arrlength = x+a.length;
			//alert(a[x]);
			ObjNxt = document.getElementById(IDNxt);
			ObjPrev = document.getElementById(IDPrev);

			document.getElementById('401').src = a[x];
			document.getElementById('402').src = a[x+1];
			document.getElementById('403').src = a[x+2];
			document.getElementById('404').src = a[x+3];


			document.getElementById('h1').value = b[x];
			document.getElementById('h2').value = b[x+1];
			document.getElementById('h3').value = b[x+2];
			document.getElementById('h4').value = b[x+3];
			//alert(document.getElementById('h1').innerText);

			//alert(document.getElementById('1').src);
			if(x <= 0) {
				ObjPrev.disabled = true;
			}
			if(total >= arrlength) {

				ObjNxt.disabled = true;
			}
			return false;
		}

			function next(total, IDNxt, IDPrev)
			{
					ObjNxt = document.getElementById(IDNxt);
					ObjPrev = document.getElementById(IDPrev);
					arraylength = a.length-total;

					if(x >= arraylength-1) {

						ObjNxt.disabled = true;

					} else {
						ObjNxt.disabled = false;
					}

						ObjPrev.disabled = false;

					x = x+1 ;

					document.getElementById('401').src=a[x];
					document.getElementById('402').src=a[x+1];
					document.getElementById('403').src=a[x+2];
					document.getElementById('404').src=a[x+3];

					document.getElementById('h1').value=b[x];
					document.getElementById('h2').value=b[x+1];
					document.getElementById('h3').value=b[x+2];
					document.getElementById('h4').value=b[x+3];


					return false;

			}

			function prev(total, IDNxt, IDPrev)
			{

					ObjNxt = document.getElementById(IDNxt);
					ObjPrev = document.getElementById(IDPrev);
					arraylength = a.length;
					if(x <= 1)
					{
						ObjPrev.disabled = true;

					}else{

						ObjPrev.disabled = false;
					}

					ObjNxt.disabled = false;


					x = x-1 ;
					document.getElementById('401').src=a[x];
					document.getElementById('402').src=a[x+1];
					document.getElementById('403').src=a[x+2];
					document.getElementById('404').src=a[x+3];

					document.getElementById('h1').value=b[x];
					document.getElementById('h2').value=b[x+1];
					document.getElementById('h3').value=b[x+2];
					document.getElementById('h4').value=b[x+3];

					return false;

			}


/*function openfeedback(mypagename){
//	alert(mypagename);
 window.open ("feedback.php?pagename="+mypagename,feedback Card); 
	
}*/



/***********************************************
* Dock Content script- Created by and � Dynamicdrive.com
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full script
***********************************************/

var offfsetfromedge=0      //offset from window edge when content is "docked". Change if desired.
var dockarray=new Array() //array to cache dockit instances
var dkclear=new Array()   //array to cache corresponding clearinterval pointers

function dockit(el, duration){
this.source=document.all? document.all[el] : document.getElementById(el);
this.source.height=this.source.offsetHeight;
this.docheight=truebody().clientHeight;
this.duration=duration;
this.pagetop=0;
this.elementoffset=this.getOffsetY();
dockarray[dockarray.length]=this;
var pointer=eval(dockarray.length-1);
var dynexpress='dkclear['+pointer+']=setInterval("dockornot(dockarray['+pointer+'])",100);';
dynexpress=(this.duration>0)? dynexpress+'setTimeout("clearInterval(dkclear['+pointer+']); dockarray['+pointer+'].source.style.top=0", duration*1000)' : dynexpress;
eval(dynexpress);
}

dockit.prototype.getOffsetY=function(){
var totaloffset=parseInt(this.source.offsetTop);
var parentEl=this.source.offsetParent;
while (parentEl!=null){
totaloffset+=parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function dockornot(obj){
obj.pagetop=truebody().scrollTop;
if (obj.pagetop>obj.elementoffset) //detect upper offset
obj.source.style.top=obj.pagetop-obj.elementoffset+offsetfromedge+"px";
else if (obj.pagetop+obj.docheight<obj.elementoffset+parseInt(obj.source.height)) //lower offset
obj.source.style.top=obj.pagetop+obj.docheight-obj.source.height-obj.elementoffset-offsetfromedge+"px";
else
obj.source.style.top=0;
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

var dock0=new dockit("divStayTopLeft", 0);
//var dock1=new dockit("dockcontent1", 10);
function JSFX_FloatTopDiv()
{
	var startX = 3,
	startY = 150;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	function ml(id)
	{

		try{
		//var  verticalpos;
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startX;
		
		if (verticalpos==20)
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		el.y -= startY;
		}
		return el;
		}catch(e){
	}
	}
	window.stayTopLeft=function()
	{
		try{
		var  verticalpos
		if (verticalpos==20){
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
		}catch(e){}
	}
	try{
	ftlObj = ml("divStayTopLeft");
	stayTopLeft();
		}catch(e){}
}
JSFX_FloatTopDiv();

