
function Newsletters(Url) {
	var newWindow1;
	Eemail=document.getElementById('NewsEmail').value;
	var props1 = 'statusbars=yes,scrollBars=no,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=445,height=600,top=100,left=200';
	newWindow1 = window.open(Url+'&Eemail='+Eemail, 'Upload_Images_to_server', props1);
}



function popMe(strLocation, strHeight, strWidth) {
		var features = "status, height="+ strHeight +", width="+ strWidth +", scrollbars=yes, resizable=yes"
		var win = window.open(strLocation, '', features);
		win.focus();
	}
var popUpWin=0;

function popUpWindow(URLStr, left, top, width, height)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

var TableOpId=0;
function chowrecord(id){

  if( TableOpId !=0)
	{
		 document.getElementById(TableOpId).style.display='none';
	
	}
	 document.getElementById(id).style.display='block';
	TableOpId=id;
		//alert(id)
		}
function KoeinFormold(flag){
		var message = "";
	if (flag==1){
			if (document.InfForm.companyName.value.length == 0) {
				if (message.length == 0) message = message + "Please enter your: \n\n";
				message = message + "Company Name \n";
				}
	        }
		if (document.InfForm.firstName.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "First Name \n";
			}

		if (document.InfForm.address1.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Address \n";
			}



		if (document.InfForm.password.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Password \n";
			}
		if (document.InfForm.email.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Email\n";
			}
		
		email = document.InfForm.email.value
		if(document.InfForm.email.value.length !=0){
		AtPos = email.indexOf("@")
		StopPos = email.lastIndexOf(".")

			if (AtPos == -1 || StopPos == -1) {
			if (message.length == 0) message = message + "not valid email Address\n";
			}

       }
		if (document.InfForm.password.value != document.InfForm.ConfirmPassword.value) {
			if (message.length == 0) message = message + "Password and confirm password must have the same values: \n\n";
			//message = message + "Password field cannot be left empty\n";
			}
		
		if(message.length > 0) {
			alert(message);
			return false;
			}
		else{
			return true;
			}
}

function KoeinFormSeller(flag){
		var message = "";

		if (document.InfForm.firstName.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "First Name \n";
			}

		if (document.InfForm.address1.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Address1 \n";
			}



		if (document.InfForm.password.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Password \n";
			}
		
		if (document.InfForm.email.value.length == 0) {
			if (message.length == 0) message = message + "Please enter your: \n\n";
			message = message + "Email \n";
			}
		email = document.InfForm.email.value
		if(document.InfForm.email.value.length !=0){
		AtPos = email.indexOf("@")
		StopPos = email.lastIndexOf(".")

			if (AtPos == -1 || StopPos == -1) {
			if (message.length == 0) message = message + "not valid email Address\n";
			}

       }
		if (document.InfForm.password.value != document.InfForm.ConfirmPassword.value) {
			if (message.length == 0) message = message + "Password and confirm password must have the same values: \n\n";
			//message = message + "Password field cannot be left empty\n";
			}
			
		if(message.length > 0) {
			alert(message);
			return false;
			}
		else{
			return true;
			}
}
function openEditor(text_field,formName) {
	var newWindow1;
	var props1 = 'scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=800,height=600,top=100,left=100';
	newWindow1 = window.open('../kpanel/textEditor/test1.asp?text_field='+text_field+'&formName='+formName, 'Upload_Images_to_server', props1);
	}

function KoeinpropForm(){
		var message = "";


		if (document.propForm.nname.value.length == 0) {
			if (message.length == 0) message = message + "Please enter : \n\n";
			message = message + "Property Main Top Title \n";
			}
		if (document.propForm.smallDescription.value.length == 0) {
			if (message.length == 0) message = message + "Please enter : \n\n";
			message = message + "Small Description \n";
			}	
		if (document.propForm.price.value == '0') {
			if (message.length == 0) message = message + "Please enter : \n\n";
			message = message + "price \n";
			}
		if (document.propForm.areaSur.value == '0') {
			if (message.length == 0) message = message + "Please enter : \n\n";
			message = message + "Area \n";
			}
		if (document.propForm.smallpicture.value == '') {
			if (message.length == 0) message = message + "Please enter : \n\n";
			message = message + "Picture \n";
			}


			

		if(message.length > 0) {
			alert(message);
			return false;
			}
		else{
			return true;
			}
}
function changeLocation(target1,text,target2) {
	if (document.propForm)
			{
			doyou = confirm(text); //Your question.
			
			if (doyou == true)
			
			{
			//window.location=target+'?id='+id; //If your question is answered Yes.
			
			document.propForm.action=target1;
			document.propForm.submit();
			}
			
			else
			{
			window.location=target2;
			}
			}
else
{
		window.location=target2;
}
}

function changeLocation1(target1,text,target2) {
	if (document.propForm)
			{
			doyou = confirm(text); //Your question.
			
			if (doyou == true)
			
			{
			//window.location=target+'?id='+id; //If your question is answered Yes.
			
			document.formFeat.action=target1;
			document.formFeat.submit();
			}
			
			else
			{
			window.location=target2;
			}
			}
else
{
		window.location=target2;
}
}

function uploadImages(pic) {
	var newWindow1;
	var props1 = 'statusbars=yes,scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=350,height=120,top=100,left=200';
	newWindow1 = window.open('editprdpicture.asp?pic='+pic+'', 'Upload_Images_to_server', props1);
}
function uploadImagesAgent(pic)
{
	var newWindow1;
	var props1 = 'statusbars=yes,scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=350,height=120,top=100,left=200';
	newWindow1 = window.open('editpictureAgent.asp?pic='+pic+'', 'Upload_Images_to_server', props1);
}
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}
function Delete(target,text) {

doyou = confirm(text); //Your question.


if (doyou == true)
{
window.location=target; //If your question is answered Yes.
}
}	
function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
   
function DeleteProp(target,text) {

doyou = confirm(text); //Your question.


if (doyou == true)
{
window.location=target; //If your question is answered Yes.
}

}

function changeValue(inputName,thisValue)
{
document.getElementById(inputName).value=thisValue;

	}

function checkIfSubmit(edit,skipFreind)
{
	if (KoeinForm())
	{
			document.InfForm.action='newRegistrationSubmit.asp?edit='+edit+'&skipFreind='+skipFreind;
			document.InfForm.submit();
		}
	}
 var popUpWin=0;

function popUpWindow1(URLStr, left, top, width, height)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}
function switchImage(imgName, imgSrc) 

{

  if (document.images)

  {

    if (imgSrc != "none")

    {

      document.images[imgName].src = imgSrc;

    }

  }

}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) 
		{document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
var testSearch='close';
function ChangeSearch(closetext,opentext)
{
if (testSearch=='close')
{
	testSearch='open';
	setTextOfLayer('optionDiv','',opentext)
	document.getElementById('searchTable').style.display='block';
	
}
else if (testSearch=='open')
{
	setTextOfLayer('optionDiv','',closetext)
	testSearch='close';
	document.getElementById('searchTable').style.display='none';

}
}
function uploadImagesX(pic,tdid,formName,folder) {
	var newWindow1;
	var props1 = 'statusbar=yes,scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=450,height=120,top=100,left=200';
	newWindow1 = window.open('resize.aspx?folder='+folder+'&formName='+formName+'&pic='+pic+'&tdid='+tdid, 'Upload_Images_to_server', props1);
}
function uploadImagesXAdv(pic,tdid,formName,folder) {
	var newWindow1;
	var props1 = 'statusbar=yes,scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=450,height=120,top=100,left=200';
	newWindow1 = window.open('resizeAds.aspx?folder='+folder+'&formName='+formName+'&pic='+pic+'&tdid='+tdid, 'Upload_Images_to_server', props1);
}
function uploadImagesDin(picture,pic,location,formName,WIDTH1,HEIGHT1) {
	var newWindow1;
	var props1 = 'statusbars=yes,scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=480,height=120,top=100,left=200';
	newWindow1 = window.open('editAgentpicture.aspx?pic='+pic+'&formName='+formName+'&thefolder='+location+'&picture='+picture+'&WIDTH1='+WIDTH1+'&HEIGHT1='+HEIGHT1, 'Upload_Images_to_server', props1);
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function autofitIframe(id){
if (!window.opera && !document.mimeType && document.all && document.getElementById){
parent.document.getElementById(id).style.height=this.document.body.offsetHeight+"px";
}
else if(document.getElementById) {
parent.document.getElementById(id).style.height=this.document.body.scrollHeight+"px"
}
}
function onlynb()
{
	if((window.event.keyCode<48)||(window.event.keyCode>57))
		{
		alert("Only Numbers");
		window.event.keyCode="";
		}
}		
function changeLocationSearch(target,idString) {

  var IDarray=idString.split(",");
  var thisID=IDarray[0]	 
  document.searchForm.pos1.value=IDarray[1]
  document.searchForm.pos2.value=IDarray[2]
  document.searchForm.zoom.value=IDarray[3]
  var viewRes=document.searchForm.viewRes.value;
  if (viewRes=='2' && IDarray[1]!='0'){document.mapFrame.goto_map_position(IDarray[1],IDarray[2],IDarray[3]);}
  contentObj=document.getElementById('searchID');
 // alert(target+thisID);
  getAjaxFile(target+thisID);
}
function changeCountryArea(target) {

  //var IDarray=idString.split(",");
 // var thisID=IDarray[0]	 
 // document.searchForm.pos1.value=IDarray[1]
 //document.searchForm.pos2.value=IDarray[2]
 // document.searchForm.zoom.value=IDarray[3]
 // var viewRes=document.searchForm.viewRes.value;
 // if (viewRes=='2' && IDarray[1]!='0'){document.mapFrame.goto_map_position(IDarray[1],IDarray[2],IDarray[3]);}
  contentObj=document.getElementById('thisCountryAreaId');
 // alert(target+thisID);
  //var IDarray=idString.split(",");
 // var thisID=IDarray[0]	 
  getAjaxFile(target);
  
  
}
function changeLocationSearchCity(idString) {
  var IDarray=idString.split(",");
  var thisID=IDarray[0]	
  document.searchForm.pos1.value=IDarray[1]
  document.searchForm.pos2.value=IDarray[2]
  document.searchForm.zoom.value=IDarray[3]
  var viewRes=document.searchForm.viewRes.value;
  if (viewRes=='2' && IDarray[1]!='0'){document.mapFrame.goto_map_position(IDarray[1],IDarray[2],IDarray[3]);}
}
  var oldpos1;
  var oldpos2;
  var oldzoom;
  
var ajax = new sack();
var articleListObj;
var activeArticle = false;
var clickedArticle = false;
var contentObj	// Reference to article content <div>

function mouseoverArticle()	// Highlight article
{
	if(this==clickedArticle)return;
	if(activeArticle && activeArticle!=this){
		if(activeArticle==clickedArticle)
			activeArticle.className='articleClick';
		else
			activeArticle.className='';
		
	}
	this.className='articleMouseOver';
	activeArticle = this;	// Storing reference to this article
}

function showContent()	// Displaying content in the content <div>
{
	contentObj.innerHTML = ajax.response;	// ajax.response is a variable that contains the content of the external file	
}

function showWaitMessage()
{
	contentObj.innerHTML = 'Finding article.....<br>Please wait';
}
function getAjaxFile(fileName)
{
	ajax.requestFile = fileName;	    // Specifying which file to get
	ajax.onCompletion = showContent;	// Specify function that will be executed after file has been found
	ajax.onLoading = showWaitMessage;   // Action when AJAX is loading the file
	ajax.runAJAX();  
}

function changeLocationSearch(target,idString) {
  var IDarray=idString.split(",");
  var thisID=IDarray[0]	
  contentObj=document.getElementById('searchID');
 // alert(target+thisID);
  getAjaxFile(target+thisID);
  
   
}
  var oldpos1;
  var oldpos2;
  var oldzoom;

function changeMapLocation(mapString)
{
  var mapStringarray=mapString.split(",");
  var thisID=mapStringarray[0];	
  
  var pos1=parseFloat(mapStringarray[1]);
  var pos2=parseFloat(mapStringarray[2]);
  var zoom=parseFloat(mapStringarray[3]);
  //alert(oldpos1+'///'+oldpos2+'///'+oldzoom);
 //alert(thisID)
  if (parseInt(thisID)==0) 
  {
  	//if (oldpos1!='' && oldpos2!='' && oldzoom!='' && oldpos1!='0' && oldpos2!='0' && oldzoom!='0')
	//{ //  
	//	mapFrame.goto_map_position(oldpos1,oldpos2,oldzoom);
   // }
	//else
	//{
		mapFrame.BackToIniPos();
	//}
  }
  else if (pos1!='' && pos2!='' && zoom!='' && pos1!='0' && pos2!='0' && zoom!='0')
  {
    //alert(pos1+'///'+pos2+'///'+zoom);
   //oldpos1=parseFloat(mapStringarray[1]);
   //oldpos2=parseFloat(mapStringarray[2]);
   //oldzoom=parseFloat(mapStringarray[3]);
	document.searchForm.pos1.value=pos1;
	document.searchForm.pos2.value=pos2;
	document.searchForm.zoom.value=zoom;
  	mapFrame.goto_map_position(pos1,pos2,zoom);
	
  }
}
function messageWindow(title, msg)

{

  var width="300", height="125";

  var left = (screen.width/2) - width/2;

  var top = (screen.height/2) - height/2;

  var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;

  var msgWindow = window.open("","msgWindow", styleStr);

  var head = '<head><title>'+title+'</title></head>';

  var body = '<center>'+msg+'<br><p><form><input type="button" value="   Done   " onClick="self.close()"></form>';

  msgWindow.document.write(head + body);

}  
 function alttxtf(){
  AT.navtxt=(AT.ns4)?document.layers['navtxt']:(AT.ie4)?document.all['navtxt']:(AT.w3c)?document.getElementById('navtxt'):null;
  getboxwidth();
  getboxheight();
  getwindowdims();
  if(AT.ie4||AT.ie5&&dofade)AT.navtxt.style.filter="alpha(opacity=100)";
  AT.navtxt.onmouseover=function(){
  if(!mousefollow)clearTimeout(AT.dy);
  }
  AT.navtxt.onmouseout=function(){
  if(!mousefollow)AT.dy=setTimeout('hideAlttxt()',hideDelay);
  }
  if(AT.ns4)document.captureEvents(Event.MOUSEMOVE);
  document.onmousemove=moveobj;
  window.onresize=getwindowdims;
}

function setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) 
		{document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
function changeBedrooms(id)
{
	if (id=='0')
	{
			document.getElementById('bedroomTd1').style.display='none';
			document.getElementById('bedroomTd2').style.display='none';
	}
	else
	{
			document.getElementById('bedroomTd1').style.display='block';
			document.getElementById('bedroomTd2').style.display='block';
	}
}
function uploadImages1(pic,tdid,id) {
	var newWindow1;
	var props1 = 'statusbars=yes,scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=350,height=120,top=100,left=200';
	newWindow1 = window.open('addPdf.asp?pic='+pic+'&tdid='+tdid+'&id='+id, 'Upload_Images_to_server', props1);
}