// JavaScript Document
function GoToUrl(str)
{
	location.href=str;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function mOvr(src,clrOver) { if (!src.contains(event.fromElement)){ src.style.cursor = 'hand';src.bgColor = clrOver; }}
function mOut(src,clrIn){ if (!src.contains(event.toElement)) { src.bgColor = clrIn; }}

function resizeimg2(ImgD,iwidth,iheight) { 
     var image=new Image(); 
     image.src=ImgD.src; 
     if(image.width>0 && image.height>0){ 
        if(image.width/image.height>= iwidth/iheight){ 
           if(image.width>iwidth){ 
               ImgD.width=iwidth; 
               ImgD.height=(image.height*iwidth)/image.width; 
           }else{ 
                  ImgD.width=image.width; 
                  ImgD.height=image.height; 
                } 
        } 
        else{ 
                if(image.height>iheight){ 
                       ImgD.height=iheight; 
                       ImgD.width=(image.width*iheight)/image.height; 
                }else{ 
                        ImgD.width=image.width; 
                        ImgD.height=image.height; 
                     } 
            } 
    } 
}

function $$(obj){
	return document.getElementById(obj);
}

function getMyHTML(serverPage, objID) { 
    var ajax = GetO();
      var obj = document.getElementById(objID); 
      ajax.open("GET", serverPage, true); 
      ajax.onreadystatechange = function() { 
          if (ajax.readyState == 4 && ajax.status == 200) { 
       obj.innerHTML =ajax.responseText; 
          } 
      } 
      ajax.send(null); 
}

function GetO(){
      var ajax=false; 
      try {
      ajax = new ActiveXObject("Msxml2.XMLHTTP"); 
      } catch (e) { 
     try { 
         ajax = new ActiveXObject("Microsoft.XMLHTTP"); 
      } catch (E) { 
         ajax = false; 
      } 
      }
      if (!ajax && typeof XMLHttpRequest!='undefined') { 
      ajax = new XMLHttpRequest(); 
      } 
      return ajax;
}

function ChangeOldHouseMenu(x)
	{
	for(i=0;i<=6;i++)
		{
		$$("EliteOldHouseMenu"+i).className="topC0";
		}
		$$("EliteOldHouseMenu"+x).className="topC1";
		getMyHTML("/ajax/IndexAjaxEliteOldHouse.aspx?housetype="+x,"EliteOldHouseContent");
	}



function selectSubMenu(subMenu){
  if (oldSelectedSubMenu!=null){
        oldSelectedSubMenu.className ="";
   }
   subMenu.className = "Selected";
   oldSelectedSubMenu = subMenu;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ChangeTitle(x) {
	document.getElementById("TopicTitle1").className="Off";
	document.getElementById("TopicTitle2").className="Off";
	document.getElementById("TopicTitle"+x).className="On";
	document.getElementById("TopicContent1").style.display="none";
	document.getElementById("TopicContent2").style.display="none";
	document.getElementById("TopicContent"+x).style.display="block";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function changePos() 
{
	width = document.body.clientWidth;
	height = document.body.clientHeight;
	Hoffset = img1.offsetHeight;
	Woffset = img1.offsetWidth;
	img1.style.left = xPos + document.body.scrollLeft;
	img1.style.top = yPos + document.body.scrollTop;
	if (yon) 
		{yPos = yPos + step;}
	else 
		{yPos = yPos - step;}
	if (yPos < 0) 
		{yon = 1;yPos = 0;}
	if (yPos >= (height - Hoffset)) 
		{yon = 0;yPos = (height - Hoffset);}
	if (xon) 
		{xPos = xPos + step;}
	else 
		{xPos = xPos - step;}
	if (xPos < 0) 
		{xon = 1;xPos = 0;}
	if (xPos >= (width - Woffset)) 
		{xon = 0;xPos = (width - Woffset);   }
	}
	function closeimg()
	{
	img1.style.display="none";
	}
	function start()
	 {
	 	img1.visibility = "visible";
		interval = setInterval('changePos()', delay);
	}
	function pause_resume() 
	{
		if(pause) 
		{
			clearInterval(interval);
			pause = false;}
		else 
		{
			interval = setInterval('changePos()',delay);
			pause = true; 
			}
		}
//-->



//img2
function changePos_2() 
{
	width = document.body.clientWidth;
	height = document.body.clientHeight;
	Hoffset = img2.offsetHeight;
	Woffset = img2.offsetWidth;
	img2.style.left = xPos + document.body.scrollLeft;
	img2.style.top = yPos + document.body.scrollTop;
	if (yon) 
		{yPos = yPos + step;}
	else 
		{yPos = yPos - step;}
	if (yPos < 0) 
		{yon = 1;yPos = 0;}
	if (yPos >= (height - Hoffset)) 
		{yon = 0;yPos = (height - Hoffset);}
	if (xon) 
		{xPos = xPos + step;}
	else 
		{xPos = xPos - step;}
	if (xPos < 0) 
		{xon = 1;xPos = 0;}
	if (xPos >= (width - Woffset)) 
		{xon = 0;xPos = (width - Woffset);   }
	}
	function closeimg_2()
	{
	img2.style.display="none";
	}
	function start_2()
	 {
	 	img2.visibility = "visible";
		interval_2 = setInterval('changePos_2()', delay_2);
	}
	function pause_resume_2() 
	{
		if(pause_2) 
		{
			clearInterval(interval_2);
			pause_2 = false;}
		else 
		{
			interval_2 = setInterval('changePos_2()',delay_2);
			pause_2 = true; 
			}
		}