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 MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
    //document.layers["layerCorpPopup"].zIndex = 0;
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}


function ShowDialogModal(page, title, attributes)
{
	//window.alert(navigator.userAgent);
	if (navigator.userAgent.indexOf("MSIE") != -1)
	{
	  //window.alert("MSIE");
	  attributes = attributes.replace(/,/g, ';');
	  attributes = attributes.replace(/=/g, ':');
	  attributes = attributes.replace(/width/, 'dialogWidth');
	  attributes = attributes.replace(/height/, 'dialogHeight');
	  attributes = attributes.replace(/top/, 'dialogTop');
	  attributes = attributes.replace(/left/, 'dialogLeft');
	  attributes = attributes.replace(/scrollbars/, 'scroll');
  	return window.showModalDialog( page, title, attributes );
  }
  else
  {
    //window.alert("Other");
    if (attributes != "") attributes = attributes + ",";
    return window.open(page, title, attributes + 'dependent=YES,dialog=YES,modal=YES');//.opener.MyArgs;
  }
}

function Start(page)
{
	if (navigator.userAgent.indexOf("MSIE") != -1)
	{
	  //window.alert("MSIE");
  	return window.showModalDialog( page, "CurrencyConverter", "height=400,width=390,resizable=yes,scrollbars=yes" );
  }
  else
  {
    //window.alert("Other");
    if (attributes != "") attributes = attributes + ",";
    return window.open(page, "CurrencyConverter", 'height=400,width=390,resizable=yes,scrollbars=yes,dependent=YES,dialog=YES,modal=YES').opener.MyArgs;
  }
}

function CurrencyWindow(page)
{
  ShowDialogModal( page, "CurrencyConverter", "height=700px,width=415px,resizable=yes,scrollbars=yes" );
}

function SendToAFriendWindow(page)
{
  this.open( page, "sendtoafriend", 'width=390,height=610,top=' +((screen.height/2)-210)+ ',left='+((screen.width/2)-230) + ',scrollbars=auto,menubar=no,resizable=no' );
}

function VirtualTourWindow(page) 
	{ 
		OpenWin = this.open(page, "VirtualTour", "height=525,width=630,resizable=yes,scrollbars=yes"); 
	} 

function GoogleMapWindow(page)
{
    this.open( page, "findWithGoogleMap", 'width=620,height=535,top=' +((screen.height/2)-210)+ ',left='+((screen.width/2)-230) + ',scrollbars=no,resizable=no,titlebar=no,location=no,status=no' );
}

//browser resize
function maxtable()
{
//alert("resizing window");

var isNS  =(document.layers)?true:false;

bodyW = (isNS) ? window.innerWidth : document.body.offsetWidth;

if (bodyW < 1000)
	{MainTable.width = "100%"}
  else
	{MainTable.width = 1000}
}

function hideshow(whichdiv){
//
// hide them all 

	// hide divFindOffices
	document.getElementById('divFindOffices').style.display = "none";
	document.getElementById('divFindOffices').style.visibility = "hidden";
	// hide divFindProp
	document.getElementById('divFindProp').style.display = "none";
	document.getElementById('divFindProp').style.visibility = "hidden";
	// hide divFindAgents
//	document.getElementById('divFindAgents').style.display = "none";
//	document.getElementById('divFindAgents').style.visibility = "hidden";

// now show selected tab

	document.getElementById(whichdiv).style.display = "block";
	document.getElementById(whichdiv).style.visibility = "visible";
//
}

function hideshowEurope(whichdiv){
//
// hide them all 

	// hide divFindOffices
//	document.getElementById('divSellProperty').style.display = "none";
//	document.getElementById('divSellProperty').style.visibility = "hidden";
	// hide divFindProp
	document.getElementById('divFindProp').style.display = "none";
	document.getElementById('divFindProp').style.visibility = "hidden";
	// hide divFindAgents
	document.getElementById('divFindAgents').style.display = "none";
	document.getElementById('divFindAgents').style.visibility = "hidden";

// now show selected tab

	document.getElementById(whichdiv).style.display = "block";
	document.getElementById(whichdiv).style.visibility = "visible";
//
}




function visibilityToggle(id)
{ 
	var objectClicked = null;
	if (!/string/i.test(typeof(id)))
		{objectClicked = id[0];//THIS IS HERE FOR LATER USE:
								//FIX THE DISTANCE BETWEEN THE ITEM CLICKED AND THE POPUP LIST DISPLAY
		id = id[1];
		}
	var el = document.getElementById(id).style;

	if(id == "countrypopup"){
		var el2 = document.getElementById('myState');
	} else if (id == "currencypopup") {
		var el2 = document.getElementById('myStateCurrency');
	}
	//
	if(el.visibility == "hidden") { 
		el.visibility = "visible";
		el.display = "block";
	 if (id == "countrypopup" || id == "currencypopup"){
		  el2.value = 1;
		  showHideSelect('hidden');
	 }
	} else if(el.visibility == "visible") { 
		el.visibility = "hidden"; 
		el.display = "none";
		if (id == "countrypopup" || id == "currencypopup"){
			el2.value = 0;
			showHideSelect('visible');
		}
	}
}


function checkState(e){
	var IE = document.all?true:false;
	if (!IE) document.captureEvents(Event.MOUSEMOVE)
	
	var tempX = 0;
	var tempY = 0;
	
	if (IE) { // grab the x-y pos.s if browser is IE
	tempX = event.clientX + document.body.scrollLeft;
	tempY = event.clientY + document.body.scrollTop;
	}
	else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX;
		tempY = e.pageY;
	}  
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}  
		
	var div = document.getElementById('countrypopup');
	div.style.left = tempX + 50 + "px";
	div.style.top = tempY - 200 + "px";
	
	var target = (e && e.target) || (event && event.srcElement); 
	
	var el = document.getElementById('myState').value;
	

	if(el == 1) {
		
		var obj = document.getElementById('shoCountry'); 
		var obj2 = document.getElementById('shoFlag'); 
		var obj3 = document.getElementById('shoArrow');
		
		if(target!=obj && target.parentNode !=obj2 && target.parentNode !=obj3){
		
			var el2 = document.getElementById('countrypopup').style;
			el2.visibility = "hidden"; 
			el2.display = "none";
			el = 0;
			showHideSelect('visible');
		}
	} 
	if(document.getElementById('myStateCurrency') != null && document.getElementById('currencypopup') != null)
	{
		var div = document.getElementById('currencypopup');
		div.style.left = tempX + 30 + "px";
		div.style.top = tempY - 100 + "px";
		
		el2 = document.getElementById('myStateCurrency').value;	
		
		if (el2 == 1){
			var obj = document.getElementById('shoCurrency'); 
			var obj2 = document.getElementById('shoCoins'); 
			var obj3 = document.getElementById('shoCurArrow');

			
			if(target.parentNode!=obj && target.parentNode !=obj2 && target.parentNode !=obj3){
			
				var el2 = document.getElementById('currencypopup').style;
				el2.visibility = "hidden"; 
				el2.display = "none";
				el = 0;
				showHideSelect('visible');
			}
		}
	}
}



function showHideSelect(action) {
	  if (navigator.appName.indexOf("MSIE")) {
		for (var S = 0; S < document.forms.length; S++){
			for (var R = 0; R < document.forms[S].length; R++) {
				if (document.forms[S].elements[R].options) {
					document.forms[S].elements[R].style.visibility = action;
				}
			}
		}
	}
}

// Applies  styles to input controls based on input "type"
function appendInputTypeClasses() 
{
  if ( !document.getElementsByTagName )
  {
    return;
  }
  var inputs = document.getElementsByTagName('input');
  var inputLen = inputs.length;
  for ( i=0;i<inputLen;i++ ) 
  {
    if ( inputs[i].getAttribute('type') )
    {
      inputs[i].className += ' '+inputs[i].getAttribute('type');
    }
  }
}
// Change which searchtype radio button is selected  (property or agent/office)
	function changeSearchType(searchType){
		if (searchType == 'SearchType1'){
			el = document.getElementById('SearchType1');
			el.checked = true;
			el = document.getElementById('SearchType2');
			el.checked = false;
		}
		if (searchType == 'SearchType2'){
			el = document.getElementById('SearchType2');
			el.checked = true;
			el = document.getElementById('SearchType1');
			el.checked = false;
		}
	}
	function sendMyRemaxLostPassword()
	{
	  //path to js file:  \\gttstweb02\webs$\testgeneric.slingshot.com\Sites\RemaxEuropeCommon\Includes
	  var emailTextBox = MM_findObj("ctl01_txtEmailAddress");
	  var emailAddress = emailTextBox.value;
	  //todo:  if emailAddress is blank, do nothing, else pop up the dialog
	  if((emailAddress != null)&&(emailAddress.length >1))
	  {
	    ShowDialogModal("/MyRemaxLostPassword.aspx?email=" + emailTextBox.value, "Email Lost Password", "height=200,width=350" );
	  }
	}

function OpenOfficeSelect(divOfficeNameID, emailID) 
{
  var ParmA; 
  var ParmB; 
  var MyArgs = new Array(ParmA, ParmB);
  var WinSettings = "center:yes;resizable:no;dialogHeight:300px"
  
  v_emailID = emailID;
  v_divOfficeNameID = divOfficeNameID;
  

  
  //ALTER BELOW LINE - supply correct URL for Child Form
  //var MyArgs = window.showModalDialog("http://localhost/ModalWin/ChildWebForm.aspx", MyArgs, WinSettings);
	//MyArgs = window.showModalDialog('http://www.remax-wales.com/PubScripts/SelectOffice.asp',MyArgs,'width=460,height=420,top='+((screen.height/2)-210)+',left='+((screen.width/2)-230) + ',scrollbars=yes,dependent=yes,menubar=no,resizable=no');
	MyArgs = ShowDialogModal('/Common/SelectOffice.aspx',MyArgs,'width=460px,height=420px,top='+((screen.height/2)-210)+',left='+((screen.width/2)-230) + ',scrollbars=yes,dependent=yes,menubar=no,resizable=no');
  if (MyArgs == null)
  {
    window.alert("No Office Selected");
  }
  else if (MyArgs[0].toString() == null || MyArgs[0].toString() == "")
  {
    window.alert("This office does not have email, please select another");
  }
  else
  {
    document.getElementById(emailID).value=MyArgs[0].toString();
    document.getElementById(divOfficeNameID).innerHTML=MyArgs[1].toString();
  }
}



var v_emailID;
var v_divOfficeNameID ;

function GetFF(MyArgs)
{
	document.getElementById(v_emailID).value=MyArgs[0].toString();
	document.getElementById(v_divOfficeNameID).innerHTML=MyArgs[1].toString();
}

  
function OpenOfficeSelectSell(divOfficeNameID, emailID, regionID) 
{
  var ParmA; 
  var ParmB; 
  var MyArgs = new Array(ParmA, ParmB);
  var WinSettings = "center:yes;resizable:no;dialogHeight:300px"
  var Url;
  Url = '/Common/SelectOfficeFrame.aspx?RegionID='+regionID;
  //ALTER BELOW LINE - supply correct URL for Child Form
  //var MyArgs = window.showModalDialog("http://localhost/ModalWin/ChildWebForm.aspx", MyArgs, WinSettings);
 //MyArgs = window.showModalDialog('http://www.remax-wales.com/PubScripts/SelectOffice.asp',MyArgs,'width=460,height=420,top='+((screen.height/2)-210)+',left='+((screen.width/2)-230) + ',scrollbars=yes,dependent=yes,menubar=no,resizable=no');
  MyArgs = window.showModalDialog(Url,MyArgs,'width=460,height=420,top='+((screen.height/2)-210)+',left='+((screen.width/2)-230) + ',scrollbars=no,dependent=yes,menubar=no,resizable=no');
  if (MyArgs == null)
  {
    window.alert("No Office Selected");
  }
  else if (MyArgs[0].toString() == null || MyArgs[0].toString() == "")
  {
    window.alert("This office does not have email, please select another");
  }
  else
  {
    document.getElementById(emailID).value=MyArgs[0].toString();
    document.getElementById(divOfficeNameID).innerHTML=MyArgs[1].toString();
  }
}

function ShowHideDiv(div, show)
{
  if ('True' != 'True')
  {
    if (show && ('False' == 'True'))
    {
      document.getElementById(div).style.display = "inline";
      document.getElementById(div).style.visibility = "visible";
    }
    else
    {
      document.getElementById(div).style.display = "none";
      document.getElementById(div).style.visibility = "hidden";
    }
  }
}

// This should be deprecated as it is less customizable and more vague.. Use OpenOfficeSelect() above
function OpenChild() 
{
    var ParmA; 
    var ParmB; 
    var MyArgs = new Array(ParmA, ParmB);
    var WinSettings = "center:yes;resizable:no;dialogHeight:300px"
    //ALTER BELOW LINE - supply correct URL for Child Form
    //var MyArgs = window.showModalDialog("http://localhost/ModalWin/ChildWebForm.aspx", MyArgs, WinSettings);
	//MyArgs = window.showModalDialog('http://www.remax-wales.com/PubScripts/SelectOffice.asp',MyArgs,'width=460,height=420,top='+((screen.height/2)-210)+',left='+((screen.width/2)-230) + ',scrollbars=yes,dependent=yes,menubar=no,resizable=no');
	MyArgs = ShowDialogModal('/Common/SelectOffice.aspx',MyArgs,'width=460,height=420,top='+((screen.height/2)-210)+',left='+((screen.width/2)-230) + ',scrollbars=yes,dependent=yes,menubar=no,resizable=no');
    if (MyArgs == null)
    {
        window.alert("No Office Selected");
    }
    else
    {
                                                                        // Commented because Wales was getting emails for every site
        document.getElementById('HSENDTO').value=MyArgs[0].toString(); // + ',recruitment@remax-wales.com';
        document.getElementById('officename').innerHTML=MyArgs[1].toString();
    }
}

function LangaugeChanged(LangVal)
{var curURL = location.href;
var Params = location.search.replace(/^\?/,"");
if (Params.length > 0)
	Params = Params.split('&');
if (Params.length > 0)
	curURL = curURL.replace(/\?(.*)$/, "?");
var KeyVal = null;
var curQueryString = "";

var LangKeyNotFound = true;
for (var x = 0;x<Params.length;x++)
	{KeyVal = Params[x].split('=');
	if (/^lang$/i.test(KeyVal[0]))
		{KeyVal[1] = LangVal;
		LangKeyNotFound = false;
		}
	curQueryString += "&" + KeyVal[0] + "=" + KeyVal[1]
	}

if (LangKeyNotFound)
	curQueryString += "&Lang=" + LangVal
if (/\/$/.test(curURL))
	{curURL += "Default.aspx?"
	}
else if (curURL.Length - 4 == location.hostname.length)
	{curURL += "/Default.aspx?"
	}
if (!/\?$/.test(curURL))
	curURL += '?'
//location = curURL + curQueryString.replace(/^\&/,"");
location.replace(curURL + curQueryString.replace(/^\&/,""));
}

function changeMap(){
	curURL = location.href;
	curSearch = curURL.split('SearchType=');
	curSearch = curSearch[1];
	curSearch = curSearch.split("",1);
	curSearch = curSearch[0];
	el = document.getElementById("mapImage");
	if (curSearch == 'O'){
		el.src = '/sites/REMAXSlovakia/mapimages/bratislava.gif';	
	} else {
		el.src = '/sites/REMAXSlovakia/mapimages/bratislava2.gif';	
	}
}

/* Popup div for images on Favourites/Recently Viewed */
var viewport = {
  getWinWidth: function () {
    this.width = document.body.clientWidth;
  },
  
  getWinHeight: function () {
    this.height = document.body.clientHeight;
  },
  
  getScrollX: function () {
    this.scrollX = this.scrollX = document.body.scrollLeft;
  },
  
  getScrollY: function () {
    this.scrollY = document.body.scrollTop;
  },
  
  getAll: function () {
    this.getWinWidth(); this.getWinHeight();
    this.getScrollX();  this.getScrollY();
  }
  
}

var ImagePopup = {
    followMouse: true,
    offX: 0,
    offY: 12,
    elemID: "ImagePopupDiv",
    showDelay: 100,
    hideDelay: 200,
    ready:false,
    timer:null,
    elem:null,
    init:function() {
      if(document.createElement && document.body && typeof document.body.appendChild!="undefined") {/*
        if(!document.getElementById(this.elemID)) {
          var elem=document.createElement("DIV");
          elem.id=this.elemID;
          document.body.appendChild(elem);
        }*/
        this.ready=true;
      }
    },
    show:function(e,msg) {
      if(this.timer) {
        clearTimeout(this.timer);
        this.timer=0;
      }
      this.elem=document.getElementById(this.elemID);
      if(this.followMouse) {
        if (document.addEventListener) document.addEventListener("mousemove", this.trackMouseCallback, true);
        else if (document.attachEvent) document.attachEvent("onmousemove", this.trackMouseCallback);
      }
      this.writePopup("");
      this.writePopup(msg);
      viewport.getAll();
      this.positionPopup(e);
      this.timer=setTimeout("ImagePopup.toggleVis('"+this.elemID+"', 'visible')",this.showDelay);
    },
    writePopup:function(msg) {
      if(this.elem&&typeof this.elem.innerHTML!="undefined")
        this.elem.innerHTML=msg;
    },
    hide:function() {
      if(this.timer) {
        clearTimeout(this.timer);
        this.timer=0;
      }
      this.timer=setTimeout("ImagePopup.toggleVis('"+this.elemID+"', 'hidden')",this.hideDelay);
      if(this.followMouse) {
        if (document.removeEventListener) document.removeEventListener("mousemove", this.trackMouseCallback, true);
        else if (document.detachEvent) document.detachEvent("onmousemove", this.trackMouseCallback);
      }
      this.elem=null;
    },
    toggleVis:function(id,vis) {
      var el=document.getElementById(id);
      if(el)
        el.style.visibility=vis;
    },
    trackMouseCallback:function(e) {
      e = e? e: window.event;
      e.tgt = e.srcElement? e.srcElement: e.target;
      
      if (!e.preventDefault) e.preventDefault = function () { return false; }
      if (!e.stopPropagation) e.stopPropagation = function () { if (window.event) window.event.cancelBubble = true; }
      ImagePopup.positionPopup(e);
    },
    positionPopup:function(e) { 
      if (this.elem && this.elem.style) {
        var x = 0;
        if (this.offX > 0) {  //LTR
          x = e.clientX;
          if (x + this.elem.offsetWidth + this.offX > viewport.width + viewport.scrollX) {
            x -= this.elem.offsetWidth - this.offX;
            if (x < 0) x = 0;
          } else {
            x += this.offX;
          }
        } else {  //RTL
          x = e.clientX - this.elem.parentElement.offsetLeft - this.elem.parentElement.offsetWidth - this.elem.scrollWidth;
          if (document.body.clientWidth - e.clientX + this.elem.scrollWidth + 4 - this.offX * 2 > document.body.clientWidth) {
            x += this.elem.scrollWidth;
          } else {
            x += this.offX;
          }
        }

        var y = e.pageY ? e.pageY : e.clientY + viewport.scrollY;
        if (y + this.elem.offsetHeight + this.offY > viewport.height + viewport.scrollY) {
          y = y - this.elem.offsetHeight - this.offY;
          if (y < viewport.scrollY) {
            y = viewport.height + viewport.scrollY - this.elem.offsetHeight;
          }
        } else {
          y = y + this.offY;
        }
        this.elem.style.left = (x - (typeof divStayTopLeft != "undefined" ? divStayTopLeft.offsetLeft : 0) - (typeof CurFloater != 'undefined' ? CurFloater.offsetLeft : 0)) + "px";
        this.elem.style.top = (y - (typeof divStayTopLeft != "undefined" ? divStayTopLeft.offsetTop : 0) - (typeof CurFloater != 'undefined' ? CurFloater.offsetTop : 0) - (typeof this.elem.parentElement != 'undefined' ? this.elem.parentElement.offsetTop : 0)) + "px";
      }
    }
};

function showImagePopup(e, img, txt) {
  if ( typeof ImagePopup == "undefined" || !ImagePopup.ready ) return;
	
  ImagePopup.offX = /rtl/i.test(document.dir) ? -8 : 8;
  var content = "";
  if ( img ) content += '<div class="thumb_img"><img src="' + img + '"></div>';
  if ( txt ) content += '<div class="thumb_txt">' + txt + '</div>';
  ImagePopup.show(e, content)
}

function hideImagePopup() {
  if ( typeof ImagePopup == "undefined" || !ImagePopup.ready ) return;
  ImagePopup.hide();
}
/* END Popup div for images on Favourites/Recently Viewed */

//Function to retrieve cookie value
function getCookie(name) 
{ 
    var sPos = document.cookie.indexOf(name + "="); 
    var len = sPos + name.length + 1; 
    if((!sPos) && (name != document.cookie.substring(0, name.length))){ 
        return null; 
    } 
    if(sPos == -1){ 
        return null; 
    } 
    var ePos = document.cookie.indexOf(';', len); 
    if(ePos == -1) ePos = document.cookie.length; 
    return unescape(document.cookie.substring(len, ePos)); 
} 

//The onclick event for scrolling or not scrolling from the checkbox
function StopStartScrolling()
{
    if (document.getElementById("CanScrollRegional") != null)
    {
      if (document.getElementById("CanScrollRegional").checked == true)
      {
          document.cookie = "CanScroll=NO;";
      }
      else
      {
          document.cookie = "CanScroll=YES;";
      }
      JSFX_FloatTopDiv();
    }
}

function SetScrolling()
{
    if (document.getElementById("CanScrollRegional") != null)
    {    
	  if(document.getElementById("CanScrollText") != null)
		{
		  document.getElementById("CanScrollText").innerHTML = Gryphtech.RemaxEurope.RemaxEuropeSlingshotAddin.AjaxMethods.GetTranslations("GtTranslationManagerScroll", "130.DontScrollColumn", "Remax", "130", "Lang", languageCode).value;
		}
      if (getCookie("CanScroll") == "NO")
      {
          document.getElementById("CanScrollRegional").checked = true;
      }
      else if (getCookie("CanScroll") == "YES")
      {
          document.getElementById("CanScrollRegional").checked = false;
      }
      else
      {
          document.getElementById("CanScrollRegional").checked = false;
      }
    }
}

/* Floating Sidebar */
function JSFX_FloatTopDiv()
{
    var scrolling;
    
    if (getCookie("CanScroll") == "NO")
    {
        scrolling = false;
		if(document.getElementById("CanScrollRegional") != null)
		{
	        document.getElementById("CanScrollRegional").checked = true;
		}
    }
    else if (getCookie("CanScroll") == "YES")
    {
        scrolling = true;
		if(document.getElementById("CanScrollRegional") != null)
		{
	        document.getElementById("CanScrollRegional").checked = false;
		}
    }
    else
    {//When coookie "CanScroll" is null
        scrolling = true;
		if(document.getElementById("CanScrollRegional") != null)
		{
	        document.getElementById("CanScrollRegional").checked = false;
		}
    }
    
    function ml(id) 
    {
        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;
            if (y > -1)
            {           
                this.style.top=y;
            }
            else
            {//Sends floating div back to top
                this.style.top=0;
            }
        };
        el.x = startX;
        
        if (typeof verticalpos == 'undefined')
        {
            el.y = 0;
        }
        else if (verticalpos=='fromtop')
        {
            el.y = startY;
        }
        else
        {
            el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
            el.y -= startY;
        }
        
        return el;
    }
    
    window.stayTopLeft=function() 
    {
        if (typeof verticalpos == 'undefined')
        {
	        var pY = 0;
	        ftlObj.y = 0;
        }
        else if (verticalpos=='fromtop')
        {
	        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;
        }
        if (document.body.scrollTop + (typeof CurChildFloater != 'undefined'?CurChildFloater.scrollHeight:0) + 5> MainFooterDiv.offsetTop)
        {
          ftlObj.y = MainFooterDiv.offsetTop - (typeof CurChildFloater != 'undefined'?CurChildFloater.scrollHeight:0) - (typeof CurrentFloatingTop != 'undefined'?CurrentFloatingTop:0) - 5;
        }
        else if (document.body.scrollTop - (typeof CurrentFloatingTop != 'undefined'?CurrentFloatingTop:0) < 0)
        {
          ftlObj.y = 0
        }

        ftlObj.sP(ftlObj.x, ftlObj.y);
        setTimeout('stayTopLeft()', 10);
    }
    var startX = 0;
    var startY;
    var ns = (navigator.appName.indexOf('Netscape') != -1);
    var d = document;
    
    if (scrolling)
    {
        startY = (typeof CurrentFloatingTop != 'undefined'?-CurrentFloatingTop:0) + 5;
        ftlObj = ml('divStayTopLeft');
        stayTopLeft();
    }
}


/* Europe Modules */
function loadRegion(whichForm){
	el = document.getElementById(whichForm).value;
	if (el != "Select Region")
		window.location.href = el;
}

function enableButton(whichForm,whichButton){
	el = document.getElementById(whichButton);
	el2 = document.getElementById(whichForm).value;
	if (el2 != "Select Region"){
		el.disabled = false;
		el.className = "btnEnabled"
	} else {
		el.disabled = true;
		el.className = "btnDisabled"
	}
}

/**/

/*Portugal's Form */

function validate(frmForm)
{
	// Place validation code here if required.
	var requiredInfoMissing = false;
	var bgcolorRed = "#ff0000";
	var bgcolorWhite = "#ffffff";
	
	if (document.all["Nome Completo"].value == "")
	{
		document.all["Nome Completo"].style.background = bgcolorRed;
		document.all["Nome Completo"].focus();
		requiredInfoMissing = true;
	}
	else
	{
	    document.all["Nome Completo"].style.background = bgcolorWhite;
	}
	 
	if (document.all["Telefone"].value == "") 
	{
		document.all["Telefone"].style.background = bgcolorRed;
		document.all["Telefone"].focus();
		requiredInfoMissing = true;
	} 
	else
	{
	    document.all["Telefone"].style.background = bgcolorWhite;
	}
		
	if (document.all["Telemovel"].value == "") 
	{
		document.all["Telemovel"].style.background = bgcolorRed;
		document.all["Telemovel"].focus();
		requiredInfoMissing = true;
	} 
	else
	{
	    document.all["Telemovel"].style.background = bgcolorWhite;
	}
	
	
	
	if (requiredInfoMissing)
	{
	    return false;
	}
	else
	{
		frmForm.submit();
		return true;
	}
		
}

function ValidateForm()

{

            var office = MM_findObj("officename");     

            if (!office.innerText.length > 0 ) {

                        // copy needed.

                        alert('Por favor seleccione a Loja.');

                        return false;

            }

}


/**/

function SetQueryStringParam(qs, pname, pvalue)
{
  if(qs.length > 1) this.q = qs.substring(1, qs.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(this.q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.found = false;
	for(var j=0; j < this.keyValuePairs.length && !this.found; j++) {
		if(this.keyValuePairs[j].split("=")[0] == pname) {
			this.keyValuePairs[j] = pname + "=" + pvalue;
			this.found = true;
		}
	}
	if(!this.found) {
	  this.keyValuePairs[this.keyValuePairs.length] = pname + "=" + pvalue;
	}
	this.q = "?";
	for(var k=0; k < this.keyValuePairs.length; k++) {
	  this.q += keyValuePairs[k] + "&";
	}
	this.q = this.q.substring(0,this.q.length - 1);
	return this.q;
}

function CheckValue(obj, target)
{if (document.getElementById(target) != null)
  	{return document.getElementById(target).value == obj.value;
    }
return true;
}

function SetValue(obj, target) {
  if (document.getElementById(target) != null)
  	{document.getElementById(target).value = obj.value;
    }
}

function SetZero(target) {
  if (document.getElementById(target) != null)
  	document.getElementById(target).value = '0';
}

function AjaxBind_Select_DataTable(selectObj, dataTableObj, valueFieldName, textFieldName, defaultOptionText) {
  //clear select before binding
  selectObj.options.length = 1;

  if (dataTableObj != null && dataTableObj.value != null && dataTableObj.value.Rows != null) {
    var isIE = false;
    if (navigator.appVersion.indexOf("MSIE")!=-1) isIE = true;
    for (var i=0; i < dataTableObj.value.Rows.length; ++i) {
      var row = dataTableObj.value.Rows[i];
      var oOption = new Option(row[textFieldName], row[valueFieldName]);
      if (isIE) {
        selectObj.add(oOption); // IE only
      } else {
        selectObj.add(oOption, null); // standards compliant
      }
      /*
      try {
        selectObj.add(oOption, null); // standards compliant
      }
      catch(ex) {
        selectObj.add(oOption); // IE only
      }
      */
    }
  }
  if (defaultOptionText != null && defaultOptionText != "") {
    selectObj.options[0].text = defaultOptionText;
    selectObj.options[0].value = '0';
  }
  else
  {
    selectObj.remove(0);
  }
}

function GetSelectedItem(ddlId) {
  var DDL = document.getElementById(ddlId);
  var val = "";
  if (DDL != null && DDL.selectedIndex != -1)
    val = DDL.options[DDL.selectedIndex].value;
  	if (isNaN(val))
	{
		return 0;
	}
	else
	{
  		return val;
	}
}

function SetSelectValue(ddlId, val) {
  var selectobj = document.getElementById(ddlId);
  if (selectobj != null && val != null && val >= 0) {
    for (var i=0; i < selectobj.length; i++)
      if (selectobj.options[i].value == val)
        selectobj.selectedIndex = i;
  }
}

/* RE/MAX Europe's menu*/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only


function clearCookie(){
	var cookie_date = new Date ( );  // current date & time
   cookie_date.setTime ( cookie_date.getTime() - 1 );
   blockid = 1;
	var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname;
	var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid;
	//alert(cookiename);
	document.cookie=cookiename+"="+cookievalue;
}

/* */	

/* Thinking of Selling Validation */

function checkMyForm(){
	form = document.getElementById("sellContactForm");
	
	if (form.txtFullName.value == ""){
		alert("Please fill in your full name");
		form.txtFullName.focus();
		return false;
	}
	
	if (form.txtEmailAddress.value == ""){
		alert("Please fill in your email address");
		form.txtEmailAddress.focus();
		return false;
	}
	
	if (form.txtPhone.value == ""){
		alert("Please fill in your phone number");
		form.txtPhone.focus();
		return false;
	}
	
	if (form.txtCityLong.value == ""){
		alert("Please fill in your city");
		form.txtCityLong.focus();
		return false;
	}

		if (form.txtOfficeEmail.value == ""){
		alert("Please select an office");
		return false;
	}
	
	if (form.selPropertyType.value == "0"){
		alert("Please select a Property Type");
		return false;
	}

	return true;
	
}


function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.

/*
if(NoneWithCheck(document.exampleform.radioOne))
	{ errormessage += "\n\nPlease click one radio button of the set of three."; }
if(WithoutCheck(document.exampleform.radioLoner))
	{ errormessage += "\n\nThe \"Loner\" radio button must be clicked."; }
if(NoneWithCheck(document.exampleform.checkOne))
	{ errormessage += "\n\nPlease check one or more check boxes of the set of three."; }
if(WithoutCheck(document.exampleform.checkLoner))
	{ errormessage += "\n\nThe \"Loner\" check box must be checked."; }
*/
if(WithoutContent(document.all.officename.innerHTML))
	{ errormessage += "\n\nBitte wählen Sie ein Büro aus durch anklicken des Büronamens."; }
/*
if(NoneWithContent(document.exampleform.oneOrTheOther))
	{ errormessage += "\n\nSomething must be typed in one or both of the set of form text fields."; }
if(WithoutContent(document.exampleform.areaName.value))
	{ errormessage += "\n\nSomething must be typed in the textarea box."; }
if(WithoutContent(document.exampleform.FileGet.value))
	{ errormessage += "\n\nA file name must be provided for uploading."; }
if(WithoutSelectionValue(document.exampleform.dropname))
	{ errormessage += "\n\nPlease select something from the dropdown list."; }
*/

// Put field checks above this point.
if(errormessage.length > 2) {
	alert(errormessage);
	return false;
	}
return true;
} // end of function CheckRequiredFields()


function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

/*
function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].value.length > 0) { return false; }
	}
return true;
}

function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].checked) { return false; }
	}
return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value.length) { return false; }
		}
	}
return true;
}
*/

function clearDefault(el){
    if(el.defaultValue==el.value) el.value="";
    //el.style.color='black';
}
function restoreDefault(el){
    if(el.value==""){
    el.value = el.defaultValue;
    //el.style.color='gray';
    }
}

function ShowHideFeatures(obj)
{
	if(obj != null)
	{
		if(obj.value == 2) //Residential
		{
			if (document.all["divPropertyType"] != null)
			{
				document.all["divPropertyType"].style.display = "inline";
			}
			if (document.all["divCommPropertyType"] != null)
			{
				document.all["divCommPropertyType"].style.display = "none";
			}
		}
		if(obj.value == 1) //Commercial
		{
			if (document.all["divPropertyType"] != null)
			{
				document.all["divPropertyType"].style.display = "none";
			}
			if (document.all["divCommPropertyType"] != null)
			{
				document.all["divCommPropertyType"].style.display = "inline";
			}
		}
	}
}

/* The <%%> does not work in pure js file, only work with .aspx file CR # 46009

*/
		
function ClearValue()
{
	document.forms[0].reset;
}

function SetStatusValue(obj, target)
{
	if(obj.checked)
	{
		document.getElementById(target).value = obj.value;
	}
	else
	{
		document.getElementById(target).value = "";
	}
}

var minPrice = "";
function SetMinPrice(MinPriceVal)
{
    minPrice = MinPriceVal;
}

        function SetMinMaxPriceRange(obj, divPriceClientId, divRentalPriceClientId, ddlMinPriceClientId, ddlMaxPriceClientId, ddlRentalMinPriceClientId, ddlRentalMaxPriceClientId)
		{	 
			//alert(obj.value);
			var ddlMinPrice = document.getElementById(ddlMinPriceClientId.id);
			var ddlMaxPrice = document.getElementById(ddlMaxPriceClientId.id);
			var ddlRentalMinPrice = document.getElementById(ddlRentalMinPriceClientId.id);
			var ddlRentalMaxPrice = document.getElementById(ddlRentalMaxPriceClientId.id);						
			var MinPrice = document.getElementById("MinPrice");
			var MaxPrice = document.getElementById("MaxPrice");		
			var RentalMinPrice = document.getElementById("RentalMinPrice");
			var RentalMaxPrice = document.getElementById("RentalMaxPrice");	
		
			if (obj.value == '260' || obj.value == '262' || obj.value == 'For Rent/Lease' || obj.value == 'Holiday/Short Term Rental')
			{
					if (document.all[divPriceClientId.id] != null)
					{
						document.all[divPriceClientId.id].style.visibility = "hidden";
						document.all[divPriceClientId.id].style.display = "none";
					}
					if (document.all[divRentalPriceClientId.id] != null)
					{
						document.all[divRentalPriceClientId.id].style.visibility = "visible";
						document.all[divRentalPriceClientId.id].style.display = "";  
					}
					if(ddlMinPrice != null)
					{
						MinPrice.value = "";
					    ddlMinPrice.selectedIndex = 0;
					}
					if(ddlMaxPrice != null)
					{
						MaxPrice.value = "";
					    ddlMaxPrice.selectedIndex = 0;
					}
			}   
			else
			{
					if (document.all[divPriceClientId.id] != null)
					{
						document.getElementById(divPriceClientId.id).style.visibility = "visible";
						document.getElementById(divPriceClientId.id).style.display = "";
					}
					if (document.all[divRentalPriceClientId.id] != null)
					{
						document.getElementById(divRentalPriceClientId.id).style.visibility = "hidden"; 
						document.getElementById(divRentalPriceClientId.id).style.display = "none";
					}
					if(ddlRentalMinPrice != null)
					{						
					    ddlRentalMinPrice.selectedIndex = 0;
						RentalMinPrice.value = "";
					}
					if(ddlRentalMaxPrice != null)
					{
					    ddlRentalMaxPrice.selectedIndex = 0;
						RentalMaxPrice.value = "";
					}
					
					MinPrice.value = minPrice;
					
					for(i = 0; i < ddlMinPrice.length; i++)
                    {
                        if(ddlMinPrice.options[i].value == minPrice)
                        {
                            ddlMinPrice.selectedIndex = i;
                        }
                    }
			}
		}
		
	function ToggleFavourite(obj, Remove)
	{
	  if (Remove)
	  {
	    if(document.getElementById("divFavAdd_" + obj))document.getElementById("divFavAdd_" + obj).style.display = "none";
	    if(document.getElementById("divFavRem_" + obj))document.getElementById("divFavRem_" + obj).style.display = "";
	  }
	  else
	  {
	    if(document.getElementById("divFavAdd_" + obj))document.getElementById("divFavAdd_" + obj).style.display = "";
	    if(document.getElementById("divFavRem_" + obj))document.getElementById("divFavRem_" + obj).style.display = "none";
	  }
	  return false;
	}
	
	function AddRemoveFavourite(obj, Add)
	{
	  if (Add)
	  {
    	SmartModuleMyRemaxRegistration.SmartModuleMyRemaxFavourites.AddPropertyToFavourites(obj, maxFavs, cookieExp, langMF, encLangMF, formatRegionId);
    }
	  else
	  {
      SmartModuleMyRemaxRegistration.SmartModuleMyRemaxFavourites.RemovePropertyFromFavourites(obj, cookieExp);
	  }
	  ToggleFavourite(obj, Add);
	  // Call function from RegionalGoogleMapListingList.ascx, if it exists
  	if (typeof(FavClicked) != 'undefined') FavClicked({ListingKey:obj,Checked:Add});
  	// Call function from MyRemaxFavourites module, if it exists.
  	if (typeof(UpdateMyFavouritesDatagrid) != 'undefined') UpdateMyFavouritesDatagrid();
	}
	
	
	function sizeAdjust(imgObj)
    {
        imgObj = document.getElementById('SLIDESIMG');
	    imgObj.style.visibility = 'hidden';
        imgObj.style.height = 'auto';
        imgObj.style.display = 'inline';
        if (imgObj.height > 375) imgObj.style.height = 375; 
	    imgObj.style.visibility = 'visible';
    }

function swap(imageID,imageNumber, imageCount, ofTranslation) 
{
	 try
    {
	      SLIDES.pause();
	     
	      //alert(SLIDES.xOfy);
	      //alert("[" + imageNumber + " "+ ofTranslation +" " + imageCount + "]");
	      SLIDES.goto_slide(imageNumber - 1);
	      
	      /*alert(SLIDES.xOfy.innerHTML);
	       alert(imageCount);
	      SLIDES.xOfy.innerHTML = "[" + imageNumber + " "+ ofTranslation +" " + imageCount + "]";
	      var img = MM_findObj(imageID);
	      var mainimg = MM_findObj('SLIDESIMG');
	      var transImage = img.src;
	      mainimg.src = img.src;
	      */
	 }
	 catch(ex)
	 {
	    alert(ex.description);
	 }
}

//This is used in ListingList
function GotoPage(val)
{
    var qs = SetQueryStringParam(window.location.search, 'CurrentPage', val);
    window.location.href = window.location.protocol + '//' + window.location.host + window.location.pathname + qs;
    return false;
}

function setMapList(map)
{
  var imgmap = document.getElementById("imgMap");
  var imglist = document.getElementById("imgList");
  var lnkmap = document.getElementById("lnkMap");
  var lnklist = document.getElementById("lnkList");
  document.getElementById("maplist").value = map;
  if (map) {
    imgmap.src = "/sites/RemaxEuropeCommon/images/check_on.gif";
    imglist.src = "/sites/RemaxEuropeCommon/images/check_off.gif";
    lnkmap.style.color = "Red";
    lnklist.style.color = "Gray";
  } else {
    imgmap.src = "/sites/RemaxEuropeCommon/images/check_off.gif";
    imglist.src = "/sites/RemaxEuropeCommon/images/check_on.gif";
    lnkmap.style.color = "Gray";
    lnklist.style.color = "Red";
  }
}

function toggleMapSearch(lnk, img, hid) {
  if (typeof(lnk) != 'undefined' && typeof(img) != 'undefined' && typeof(hid) != 'undefined') {
    hid.value = (hid.value == '' || hid.value == 1) ? 0 : 1;
    toggleMapSearchImage(lnk, img, hid);
  }
}

function toggleMapSearchImage(lnk, img, hid)
{
    if (lnk != null && typeof(lnk) != 'undefined' && img != null && typeof(img) != 'undefined' && hid != null && typeof(hid) != 'undefined') 
    {
    if (hid.value == 1) {
      img.src = "/sites/RemaxEuropeCommon/images/check_on.gif";
      //lnk.style.color = "Red";
    } else {
      img.src = "/sites/RemaxEuropeCommon/images/check_off.gif";
      //lnk.style.color = "Gray";
    }
    }
}

var curvyCornersVerbose = false;

function browserdetect(){var A=navigator.userAgent.toLowerCase();this.isIE=A.indexOf("msie")>-1;this.ieVer=this.isIE?/msie\s(\d\.\d)/.exec(A)[1]:0;this.isMoz=A.indexOf("firefox")!=-1;this.isSafari=A.indexOf("safari")!=-1;this.quirksMode=this.isIE&&(!document.compatMode||document.compatMode.indexOf("BackCompat")>-1);this.isOp="opera" in window;this.isWebKit=A.indexOf("webkit")!=-1;if(this.isIE){this.get_style=function(D,F){if(!(F in D.currentStyle)){return""}var C=/^([\d.]+)(\w*)/.exec(D.currentStyle[F]);if(!C){return D.currentStyle[F]}if(C[1]==0){return"0"}if(C[2]&&C[2]!=="px"){var B=D.style.left;var E=D.runtimeStyle.left;D.runtimeStyle.left=D.currentStyle.left;D.style.left=C[1]+C[2];C[0]=D.style.pixelLeft;D.style.left=B;D.runtimeStyle.left=E}return C[0]}}else{this.get_style=function(B,C){C=C.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return document.defaultView.getComputedStyle(B,"").getPropertyValue(C)}}}var curvyBrowser=new browserdetect;if(curvyBrowser.isIE){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}function curvyCnrSpec(A){this.selectorText=A;this.tlR=this.trR=this.blR=this.brR=0;this.tlu=this.tru=this.blu=this.bru="";this.antiAlias=true}curvyCnrSpec.prototype.setcorner=function(B,C,A,D){if(!B){this.tlR=this.trR=this.blR=this.brR=parseInt(A);this.tlu=this.tru=this.blu=this.bru=D}else{propname=B.charAt(0)+C.charAt(0);this[propname+"R"]=parseInt(A);this[propname+"u"]=D}};curvyCnrSpec.prototype.get=function(D){if(/^(t|b)(l|r)(R|u)$/.test(D)){return this[D]}if(/^(t|b)(l|r)Ru$/.test(D)){var C=D.charAt(0)+D.charAt(1);return this[C+"R"]+this[C+"u"]}if(/^(t|b)Ru?$/.test(D)){var B=D.charAt(0);B+=this[B+"lR"]>this[B+"rR"]?"l":"r";var A=this[B+"R"];if(D.length===3&&D.charAt(2)==="u"){A+=this[B="u"]}return A}throw new Error("Don't recognize property "+D)};curvyCnrSpec.prototype.radiusdiff=function(A){if(A!=="t"&&A!=="b"){throw new Error("Param must be 't' or 'b'")}return Math.abs(this[A+"lR"]-this[A+"rR"])};curvyCnrSpec.prototype.setfrom=function(A){this.tlu=this.tru=this.blu=this.bru="px";if("tl" in A){this.tlR=A.tl.radius}if("tr" in A){this.trR=A.tr.radius}if("bl" in A){this.blR=A.bl.radius}if("br" in A){this.brR=A.br.radius}if("antiAlias" in A){this.antiAlias=A.antiAlias}};curvyCnrSpec.prototype.cloneOn=function(G){var E=["tl","tr","bl","br"];var H=0;var C,A;for(C in E){if(!isNaN(C)){A=this[E[C]+"u"];if(A!==""&&A!=="px"){H=new curvyCnrSpec;break}}}if(!H){H=this}else{var B,D,F=curvyBrowser.get_style(G,"left");for(C in E){if(!isNaN(C)){B=E[C];A=this[B+"u"];D=this[B+"R"];if(A!=="px"){var F=G.style.left;G.style.left=D+A;D=G.style.pixelLeft;G.style.left=F}H[B+"R"]=D;H[B+"u"]="px"}}G.style.left=F}return H};curvyCnrSpec.prototype.radiusSum=function(A){if(A!=="t"&&A!=="b"){throw new Error("Param must be 't' or 'b'")}return this[A+"lR"]+this[A+"rR"]};curvyCnrSpec.prototype.radiusCount=function(A){var B=0;if(this[A+"lR"]){++B}if(this[A+"rR"]){++B}return B};curvyCnrSpec.prototype.cornerNames=function(){var A=[];if(this.tlR){A.push("tl")}if(this.trR){A.push("tr")}if(this.blR){A.push("bl")}if(this.brR){A.push("br")}return A};function operasheet(C){var A=document.styleSheets.item(C).ownerNode.text;A=A.replace(/\/\*(\n|\r|.)*?\*\//g,"");var D=new RegExp("^s*([\\w.#][-\\w.#, ]+)[\\n\\s]*\\{([^}]+border-((top|bottom)-(left|right)-)?radius[^}]*)\\}","mg");var G;this.rules=[];while((G=D.exec(A))!==null){var F=new RegExp("(..)border-((top|bottom)-(left|right)-)?radius:\\s*([\\d.]+)(in|em|px|ex|pt)","g");var E,B=new curvyCnrSpec(G[1]);while((E=F.exec(G[2]))!==null){if(E[1]!=="z-"){B.setcorner(E[3],E[4],E[5],E[6])}}this.rules.push(B)}}operasheet.contains_border_radius=function(A){return/border-((top|bottom)-(left|right)-)?radius/.test(document.styleSheets.item(A).ownerNode.text)};function curvyCorners(){var G,D,E,B,J;if(typeof arguments[0]!=="object"){throw curvyCorners.newError("First parameter of curvyCorners() must be an object.")}if(arguments[0] instanceof curvyCnrSpec){B=arguments[0];if(!B.selectorText&&typeof arguments[1]==="string"){B.selectorText=arguments[1]}}else{if(typeof arguments[1]!=="object"&&typeof arguments[1]!=="string"){throw curvyCorners.newError("Second parameter of curvyCorners() must be an object or a class name.")}D=arguments[1];if(typeof D!=="string"){D=""}if(D!==""&&D.charAt(0)!=="."&&"autoPad" in arguments[0]){D="."+D}B=new curvyCnrSpec(D);B.setfrom(arguments[0])}if(B.selectorText){J=0;var I=B.selectorText.replace(/\s+$/,"").split(/,\s*/);E=new Array;function A(M){var L=M.split("#");return(L.length===2?"#":"")+L.pop()}for(G=0;G<I.length;++G){var K=A(I[G]);var H=K.split(" ");switch(K.charAt(0)){case"#":D=H.length===1?K:H[0];D=document.getElementById(D.substr(1));if(D===null){curvyCorners.alert("No object with ID "+K+" exists yet.\nCall curvyCorners(settings, obj) when it is created.")}else{if(H.length===1){E.push(D)}else{E=E.concat(curvyCorners.getElementsByClass(H[1],D))}}break;default:if(H.length===1){E=E.concat(curvyCorners.getElementsByClass(K))}else{var C=curvyCorners.getElementsByClass(H[0]);for(D=0;D<C.length;++D){E=E.concat(curvyCorners.getElementsByClass(H[1],C))}}}}}else{J=1;E=arguments}for(G=J,D=E.length;G<D;++G){if(E[G]&&(!("IEborderRadius" in E[G].style)||E[G].style.IEborderRadius!="set")){if(E[G].className&&E[G].className.indexOf("curvyRedraw")!==-1){if(typeof curvyCorners.redrawList==="undefined"){curvyCorners.redrawList=new Array}curvyCorners.redrawList.push({node:E[G],spec:B,copy:E[G].cloneNode(false)})}E[G].style.IEborderRadius="set";var F=new curvyObject(B,E[G]);F.applyCorners()}}}curvyCorners.prototype.applyCornersToAll=function(){curvyCorners.alert("This function is now redundant. Just call curvyCorners(). See documentation.")};curvyCorners.redraw=function(){if(!curvyBrowser.isOp&&!curvyBrowser.isIE){return}if(!curvyCorners.redrawList){throw curvyCorners.newError("curvyCorners.redraw() has nothing to redraw.")}var E=curvyCorners.bock_redraw;curvyCorners.block_redraw=true;for(var A in curvyCorners.redrawList){if(isNaN(A)){continue}var D=curvyCorners.redrawList[A];if(!D.node.clientWidth){continue}var B=D.copy.cloneNode(false);for(var C=D.node.firstChild;C!=null;C=C.nextSibling){if(C.className==="autoPadDiv"){break}}if(!C){curvyCorners.alert("Couldn't find autoPad DIV");break}D.node.parentNode.replaceChild(B,D.node);while(C.firstChild){B.appendChild(C.removeChild(C.firstChild))}D=new curvyObject(D.spec,D.node=B);D.applyCorners()}curvyCorners.block_redraw=E};curvyCorners.adjust=function(obj,prop,newval){if(curvyBrowser.isOp||curvyBrowser.isIE){if(!curvyCorners.redrawList){throw curvyCorners.newError("curvyCorners.adjust() has nothing to adjust.")}var i,j=curvyCorners.redrawList.length;for(i=0;i<j;++i){if(curvyCorners.redrawList[i].node===obj){break}}if(i===j){throw curvyCorners.newError("Object not redrawable")}obj=curvyCorners.redrawList[i].copy}if(prop.indexOf(".")===-1){obj[prop]=newval}else{eval("obj."+prop+"='"+newval+"'")}};curvyCorners.handleWinResize=function(){if(!curvyCorners.block_redraw){curvyCorners.redraw()}};curvyCorners.setWinResize=function(A){curvyCorners.block_redraw=!A};curvyCorners.newError=function(A){return new Error("curvyCorners Error:\n"+A)};curvyCorners.alert=function(A){if(typeof curvyCornersVerbose==="undefined"||curvyCornersVerbose){alert(A)}};function curvyObject(){var U;this.box=arguments[1];this.settings=arguments[0];this.topContainer=this.bottomContainer=this.shell=U=null;var K=this.box.clientWidth;if(!K&&curvyBrowser.isIE){this.box.style.zoom=1;K=this.box.clientWidth}if(!K){if(!this.box.parentNode){throw this.newError("box has no parent!")}for(U=this.box;;U=U.parentNode){if(!U||U.tagName==="BODY"){this.applyCorners=function(){};curvyCorners.alert(this.errmsg("zero-width box with no accountable parent","warning"));return}if(U.style.display==="none"){break}}U.style.display="block";K=this.box.clientWidth}if(arguments[0] instanceof curvyCnrSpec){this.spec=arguments[0].cloneOn(this.box)}else{this.spec=new curvyCnrSpec("");this.spec.setfrom(this.settings)}var b=curvyBrowser.get_style(this.box,"borderTopWidth");var J=curvyBrowser.get_style(this.box,"borderBottomWidth");var D=curvyBrowser.get_style(this.box,"borderLeftWidth");var B=curvyBrowser.get_style(this.box,"borderRightWidth");var I=curvyBrowser.get_style(this.box,"borderTopColor");var G=curvyBrowser.get_style(this.box,"borderBottomColor");var A=curvyBrowser.get_style(this.box,"borderLeftColor");var E=curvyBrowser.get_style(this.box,"backgroundColor");var C=curvyBrowser.get_style(this.box,"backgroundImage");var Y=curvyBrowser.get_style(this.box,"backgroundRepeat");if(this.box.currentStyle&&this.box.currentStyle.backgroundPositionX){var R=curvyBrowser.get_style(this.box,"backgroundPositionX");var P=curvyBrowser.get_style(this.box,"backgroundPositionY")}else{var R=curvyBrowser.get_style(this.box,"backgroundPosition");R=R.split(" ");var P=R[1];R=R[0]}var O=curvyBrowser.get_style(this.box,"position");var Z=curvyBrowser.get_style(this.box,"paddingTop");var c=curvyBrowser.get_style(this.box,"paddingBottom");var Q=curvyBrowser.get_style(this.box,"paddingLeft");var a=curvyBrowser.get_style(this.box,"paddingRight");var S=curvyBrowser.get_style(this.box,"border");filter=curvyBrowser.ieVer>7?curvyBrowser.get_style(this.box,"filter"):null;var H=this.spec.get("tR");var M=this.spec.get("bR");var W=function(f){if(typeof f==="number"){return f}if(typeof f!=="string"){throw new Error("unexpected styleToNPx type "+typeof f)}var d=/^[-\d.]([a-z]+)$/.exec(f);if(d&&d[1]!="px"){throw new Error("Unexpected unit "+d[1])}if(isNaN(f=parseInt(f))){f=0}return f};var T=function(d){return d<=0?"0":d+"px"};try{this.borderWidth=W(b);this.borderWidthB=W(J);this.borderWidthL=W(D);this.borderWidthR=W(B);this.boxColour=curvyObject.format_colour(E);this.topPadding=W(Z);this.bottomPadding=W(c);this.leftPadding=W(Q);this.rightPadding=W(a);this.boxWidth=K;this.boxHeight=this.box.clientHeight;this.borderColour=curvyObject.format_colour(I);this.borderColourB=curvyObject.format_colour(G);this.borderColourL=curvyObject.format_colour(A);this.borderString=this.borderWidth+"px solid "+this.borderColour;this.borderStringB=this.borderWidthB+"px solid "+this.borderColourB;this.backgroundImage=((C!="none")?C:"");this.backgroundRepeat=Y}catch(X){throw this.newError("getMessage" in X?X.getMessage():X.message)}var F=this.boxHeight;var V=K;if(curvyBrowser.isOp){R=W(R);P=W(P);if(R){var N=V+this.borderWidthL+this.borderWidthR;if(R>N){R=N}R=(N/R*100)+"%"}if(P){var N=F+this.borderWidth+this.borderWidthB;if(P>N){P=N}P=(N/P*100)+"%"}}if(curvyBrowser.quirksMode){}else{this.boxWidth-=this.leftPadding+this.rightPadding;this.boxHeight-=this.topPadding+this.bottomPadding}this.contentContainer=document.createElement("div");if(filter){this.contentContainer.style.filter=filter}while(this.box.firstChild){this.contentContainer.appendChild(this.box.removeChild(this.box.firstChild))}if(O!="absolute"){this.box.style.position="relative"}this.box.style.padding="0";this.box.style.border=this.box.style.backgroundImage="none";this.box.style.backgroundColor="transparent";this.box.style.width=(V+this.borderWidthL+this.borderWidthR)+"px";this.box.style.height=(F+this.borderWidth+this.borderWidthB)+"px";var L=document.createElement("div");L.style.position="absolute";if(filter){L.style.filter=filter}if(curvyBrowser.quirksMode){L.style.width=(V+this.borderWidthL+this.borderWidthR)+"px"}else{L.style.width=V+"px"}L.style.height=T(F+this.borderWidth+this.borderWidthB-H-M);L.style.padding="0";L.style.top=H+"px";L.style.left="0";if(this.borderWidthL){L.style.borderLeft=this.borderWidthL+"px solid "+this.borderColourL}if(this.borderWidth&&!H){L.style.borderTop=this.borderWidth+"px solid "+this.borderColour}if(this.borderWidthR){L.style.borderRight=this.borderWidthR+"px solid "+this.borderColourL}if(this.borderWidthB&&!M){L.style.borderBottom=this.borderWidthB+"px solid "+this.borderColourB}L.style.backgroundColor=E;L.style.backgroundImage=this.backgroundImage;L.style.backgroundRepeat=this.backgroundRepeat;this.shell=this.box.appendChild(L);K=curvyBrowser.get_style(this.shell,"width");if(K===""||K==="auto"||K.indexOf("%")!==-1){throw this.newError("Shell width is "+K)}this.boxWidth=(K!=""&&K!="auto"&&K.indexOf("%")==-1)?parseInt(K):this.shell.clientWidth;this.applyCorners=function(){if(this.backgroundObject){var w=function(AO,i,t){if(AO===0){return 0}var k;if(AO==="right"||AO==="bottom"){return t-i}if(AO==="center"){return(t-i)/2}if(AO.indexOf("%")>0){return(t-i)*100/parseInt(AO)}return W(AO)};this.backgroundPosX=w(R,this.backgroundObject.width,V);this.backgroundPosY=w(P,this.backgroundObject.height,F)}else{if(this.backgroundImage){this.backgroundPosX=W(R);this.backgroundPosY=W(P)}}if(H){v=document.createElement("div");v.style.width=this.boxWidth+"px";v.style.fontSize="1px";v.style.overflow="hidden";v.style.position="absolute";v.style.paddingLeft=this.borderWidth+"px";v.style.paddingRight=this.borderWidth+"px";v.style.height=H+"px";v.style.top=-H+"px";v.style.left=-this.borderWidthL+"px";this.topContainer=this.shell.appendChild(v)}if(M){var v=document.createElement("div");v.style.width=this.boxWidth+"px";v.style.fontSize="1px";v.style.overflow="hidden";v.style.position="absolute";v.style.paddingLeft=this.borderWidthB+"px";v.style.paddingRight=this.borderWidthB+"px";v.style.height=M+"px";v.style.bottom=-M+"px";v.style.left=-this.borderWidthL+"px";this.bottomContainer=this.shell.appendChild(v)}var AG=this.spec.cornerNames();for(var AK in AG){if(!isNaN(AK)){var AC=AG[AK];var AD=this.spec[AC+"R"];var AE,AH,j,AF;if(AC=="tr"||AC=="tl"){AE=this.borderWidth;AH=this.borderColour;AF=this.borderWidth}else{AE=this.borderWidthB;AH=this.borderColourB;AF=this.borderWidthB}j=AD-AF;var u=document.createElement("div");u.style.height=this.spec.get(AC+"Ru");u.style.width=this.spec.get(AC+"Ru");u.style.position="absolute";u.style.fontSize="1px";u.style.overflow="hidden";var r,q,p;var n=filter?parseInt(/alpha\(opacity.(\d+)\)/.exec(filter)[1]):100;for(r=0;r<AD;++r){var m=(r+1>=j)?-1:Math.floor(Math.sqrt(Math.pow(j,2)-Math.pow(r+1,2)))-1;if(j!=AD){var h=(r>=j)?-1:Math.ceil(Math.sqrt(Math.pow(j,2)-Math.pow(r,2)));var f=(r+1>=AD)?-1:Math.floor(Math.sqrt(Math.pow(AD,2)-Math.pow((r+1),2)))-1}var d=(r>=AD)?-1:Math.ceil(Math.sqrt(Math.pow(AD,2)-Math.pow(r,2)));if(m>-1){this.drawPixel(r,0,this.boxColour,n,(m+1),u,true,AD)}if(j!=AD){if(this.spec.antiAlias){for(q=m+1;q<h;++q){if(this.backgroundImage!=""){var g=curvyObject.pixelFraction(r,q,j)*100;this.drawPixel(r,q,AH,n,1,u,g>=30,AD)}else{if(this.boxColour!=="transparent"){var AB=curvyObject.BlendColour(this.boxColour,AH,curvyObject.pixelFraction(r,q,j));this.drawPixel(r,q,AB,n,1,u,false,AD)}else{this.drawPixel(r,q,AH,n>>1,1,u,false,AD)}}}if(f>=h){if(h==-1){h=0}this.drawPixel(r,h,AH,n,(f-h+1),u,false,0)}p=AH;q=f}else{if(f>m){this.drawPixel(r,(m+1),AH,n,(f-m),u,false,0)}}}else{p=this.boxColour;q=m}if(this.spec.antiAlias){while(++q<d){this.drawPixel(r,q,p,(curvyObject.pixelFraction(r,q,AD)*n),1,u,AF<=0,AD)}}}for(var y=0,AJ=u.childNodes.length;y<AJ;++y){var s=u.childNodes[y];var AI=parseInt(s.style.top);var AM=parseInt(s.style.left);var AN=parseInt(s.style.height);if(AC=="tl"||AC=="bl"){s.style.left=(AD-AM-1)+"px"}if(AC=="tr"||AC=="tl"){s.style.top=(AD-AN-AI)+"px"}s.style.backgroundRepeat=this.backgroundRepeat;if(this.backgroundImage){switch(AC){case"tr":s.style.backgroundPosition=(this.backgroundPosX-this.borderWidthL+AD-V-AM)+"px "+(this.backgroundPosY+AN+AI+this.borderWidth-AD)+"px";break;case"tl":s.style.backgroundPosition=(this.backgroundPosX-AD+AM+this.borderWidthL)+"px "+(this.backgroundPosY-AD+AN+AI+this.borderWidth)+"px";break;case"bl":s.style.backgroundPosition=(this.backgroundPosX-AD+AM+1+this.borderWidthL)+"px "+(this.backgroundPosY-F-this.borderWidth+(curvyBrowser.quirksMode?AI:-AI)+AD)+"px";break;case"br":if(curvyBrowser.quirksMode){s.style.backgroundPosition=(this.backgroundPosX+this.borderWidthL-V+AD-AM)+"px "+(this.backgroundPosY-F-this.borderWidth+AI+AD)+"px"}else{s.style.backgroundPosition=(this.backgroundPosX-this.borderWidthL-V+AD-AM)+"px "+(this.backgroundPosY-F-this.borderWidth+AD-AI)+"px"}}}}switch(AC){case"tl":u.style.top=u.style.left="0";this.topContainer.appendChild(u);break;case"tr":u.style.top=u.style.right="0";this.topContainer.appendChild(u);break;case"bl":u.style.bottom=u.style.left="0";this.bottomContainer.appendChild(u);break;case"br":u.style.bottom=u.style.right="0";this.bottomContainer.appendChild(u)}}}var x={t:this.spec.radiusdiff("t"),b:this.spec.radiusdiff("b")};for(z in x){if(typeof z==="function"){continue}if(!this.spec.get(z+"R")){continue}if(x[z]){if(this.backgroundImage&&this.spec.radiusSum(z)!==x[z]){curvyCorners.alert(this.errmsg("Not supported: unequal non-zero top/bottom radii with background image"))}var AL=(this.spec[z+"lR"]<this.spec[z+"rR"])?z+"l":z+"r";var l=document.createElement("div");l.style.height=x[z]+"px";l.style.width=this.spec.get(AL+"Ru");l.style.position="absolute";l.style.fontSize="1px";l.style.overflow="hidden";l.style.backgroundColor=this.boxColour;switch(AL){case"tl":l.style.bottom=l.style.left="0";l.style.borderLeft=this.borderString;this.topContainer.appendChild(l);break;case"tr":l.style.bottom=l.style.right="0";l.style.borderRight=this.borderString;this.topContainer.appendChild(l);break;case"bl":l.style.top=l.style.left="0";l.style.borderLeft=this.borderStringB;this.bottomContainer.appendChild(l);break;case"br":l.style.top=l.style.right="0";l.style.borderRight=this.borderStringB;this.bottomContainer.appendChild(l)}}var o=document.createElement("div");if(filter){o.style.filter=filter}o.style.position="relative";o.style.fontSize="1px";o.style.overflow="hidden";o.style.width=this.fillerWidth(z);o.style.backgroundColor=this.boxColour;o.style.backgroundImage=this.backgroundImage;o.style.backgroundRepeat=this.backgroundRepeat;switch(z){case"t":if(this.topContainer){if(curvyBrowser.quirksMode){o.style.height=100+H+"px"}else{o.style.height=100+H-this.borderWidth+"px"}o.style.marginLeft=this.spec.tlR?(this.spec.tlR-this.borderWidthL)+"px":"0";o.style.borderTop=this.borderString;if(this.backgroundImage){var AA=this.spec.tlR?(this.backgroundPosX-(H-this.borderWidthL))+"px ":"0 ";o.style.backgroundPosition=AA+this.backgroundPosY+"px";this.shell.style.backgroundPosition=this.backgroundPosX+"px "+(this.backgroundPosY-H+this.borderWidthL)+"px"}this.topContainer.appendChild(o)}break;case"b":if(this.bottomContainer){if(curvyBrowser.quirksMode){o.style.height=M+"px"}else{o.style.height=M-this.borderWidthB+"px"}o.style.marginLeft=this.spec.blR?(this.spec.blR-this.borderWidthL)+"px":"0";o.style.borderBottom=this.borderStringB;if(this.backgroundImage){var AA=this.spec.blR?(this.backgroundPosX+this.borderWidthL-M)+"px ":this.backgroundPosX+"px ";o.style.backgroundPosition=AA+(this.backgroundPosY-F-this.borderWidth+M)+"px"}this.bottomContainer.appendChild(o)}}}this.contentContainer.style.position="absolute";this.contentContainer.className="autoPadDiv";this.contentContainer.style.left=this.borderWidthL+"px";this.contentContainer.style.paddingTop=this.topPadding+"px";this.contentContainer.style.top=this.borderWidth+"px";this.contentContainer.style.paddingLeft=this.leftPadding+"px";this.contentContainer.style.paddingRight=this.rightPadding+"px";z=V;if(!curvyBrowser.quirksMode){z-=this.leftPadding+this.rightPadding}this.contentContainer.style.width=z+"px";this.contentContainer.style.textAlign=curvyBrowser.get_style(this.box,"textAlign");this.box.style.textAlign="left";this.box.appendChild(this.contentContainer);if(U){U.style.display="none"}};if(this.backgroundImage){R=this.backgroundCheck(R);P=this.backgroundCheck(P);if(this.backgroundObject){this.backgroundObject.holdingElement=this;this.dispatch=this.applyCorners;this.applyCorners=function(){if(this.backgroundObject.complete){this.dispatch()}else{this.backgroundObject.onload=new Function("curvyObject.dispatch(this.holdingElement);")}}}}}curvyObject.prototype.backgroundCheck=function(B){if(B==="top"||B==="left"||parseInt(B)===0){return 0}if(!(/^[-\d.]+px$/.test(B))&&!this.backgroundObject){this.backgroundObject=new Image;var A=function(D){var C=/url\("?([^'"]+)"?\)/.exec(D);return(C?C[1]:D)};this.backgroundObject.src=A(this.backgroundImage)}return B};curvyObject.dispatch=function(A){if("dispatch" in A){A.dispatch()}else{throw A.newError("No dispatch function")}};curvyObject.prototype.drawPixel=function(J,G,A,F,H,I,C,E){var B=document.createElement("div");B.style.height=H+"px";B.style.width="1px";B.style.position="absolute";B.style.fontSize="1px";B.style.overflow="hidden";var D=this.spec.get("tR");B.style.backgroundColor=A;if(C&&this.backgroundImage!=""){B.style.backgroundImage=this.backgroundImage;B.style.backgroundPosition="-"+(this.boxWidth-(E-J)+this.borderWidth)+"px -"+((this.boxHeight+D+G)-this.borderWidth)+"px"}if(F!=100){curvyObject.setOpacity(B,F)}B.style.top=G+"px";B.style.left=J+"px";I.appendChild(B)};curvyObject.prototype.fillerWidth=function(A){var B=curvyBrowser.quirksMode?0:this.spec.radiusCount(A)*this.borderWidthL;return(this.boxWidth-this.spec.radiusSum(A)+B)+"px"};curvyObject.prototype.errmsg=function(C,D){var B="\ntag: "+this.box.tagName;if(this.box.id){B+="\nid: "+this.box.id}if(this.box.className){B+="\nclass: "+this.box.className}var A;if((A=this.box.parentNode)===null){B+="\n(box has no parent)"}else{B+="\nParent tag: "+A.tagName;if(A.id){B+="\nParent ID: "+A.id}if(A.className){B+="\nParent class: "+A.className}}if(D===undefined){D="warning"}return"curvyObject "+D+":\n"+C+B};curvyObject.prototype.newError=function(A){return new Error(this.errmsg(A,"exception"))};curvyObject.IntToHex=function(B){var A=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];return A[B>>>4]+""+A[B&15]};curvyObject.BlendColour=function(L,J,G){if(L==="transparent"||J==="transparent"){throw this.newError("Cannot blend with transparent")}if(L.charAt(0)!=="#"){L=curvyObject.format_colour(L)}if(J.charAt(0)!=="#"){J=curvyObject.format_colour(J)}var D=parseInt(L.substr(1,2),16);var K=parseInt(L.substr(3,2),16);var F=parseInt(L.substr(5,2),16);var C=parseInt(J.substr(1,2),16);var I=parseInt(J.substr(3,2),16);var E=parseInt(J.substr(5,2),16);if(G>1||G<0){G=1}var H=Math.round((D*G)+(C*(1-G)));if(H>255){H=255}if(H<0){H=0}var B=Math.round((K*G)+(I*(1-G)));if(B>255){B=255}if(B<0){B=0}var A=Math.round((F*G)+(E*(1-G)));if(A>255){A=255}if(A<0){A=0}return"#"+curvyObject.IntToHex(H)+curvyObject.IntToHex(B)+curvyObject.IntToHex(A)};curvyObject.pixelFraction=function(H,G,A){var J;var E=A*A;var B=new Array(2);var F=new Array(2);var I=0;var C="";var D=Math.sqrt(E-Math.pow(H,2));if(D>=G&&D<(G+1)){C="Left";B[I]=0;F[I]=D-G;++I}D=Math.sqrt(E-Math.pow(G+1,2));if(D>=H&&D<(H+1)){C+="Top";B[I]=D-H;F[I]=1;++I}D=Math.sqrt(E-Math.pow(H+1,2));if(D>=G&&D<(G+1)){C+="Right";B[I]=1;F[I]=D-G;++I}D=Math.sqrt(E-Math.pow(G,2));if(D>=H&&D<(H+1)){C+="Bottom";B[I]=D-H;F[I]=0}switch(C){case"LeftRight":J=Math.min(F[0],F[1])+((Math.max(F[0],F[1])-Math.min(F[0],F[1]))/2);break;case"TopRight":J=1-(((1-B[0])*(1-F[1]))/2);break;case"TopBottom":J=Math.min(B[0],B[1])+((Math.max(B[0],B[1])-Math.min(B[0],B[1]))/2);break;case"LeftBottom":J=F[0]*B[1]/2;break;default:J=1}return J};curvyObject.rgb2Array=function(A){var B=A.substring(4,A.indexOf(")"));return B.split(", ")};curvyObject.rgb2Hex=function(B){try{var C=curvyObject.rgb2Array(B);var G=parseInt(C[0]);var E=parseInt(C[1]);var A=parseInt(C[2]);var D="#"+curvyObject.IntToHex(G)+curvyObject.IntToHex(E)+curvyObject.IntToHex(A)}catch(F){var H="getMessage" in F?F.getMessage():F.message;throw new Error("Error ("+H+") converting RGB value to Hex in rgb2Hex")}return D};curvyObject.setOpacity=function(F,C){C=(C==100)?99.999:C;if(curvyBrowser.isSafari&&F.tagName!="IFRAME"){var B=curvyObject.rgb2Array(F.style.backgroundColor);var E=parseInt(B[0]);var D=parseInt(B[1]);var A=parseInt(B[2]);F.style.backgroundColor="rgba("+E+", "+D+", "+A+", "+C/100+")"}else{if(typeof F.style.opacity!=="undefined"){F.style.opacity=C/100}else{if(typeof F.style.MozOpacity!=="undefined"){F.style.MozOpacity=C/100}else{if(typeof F.style.filter!="undefined"){F.style.filter="alpha(opacity="+C+")"}else{if(typeof F.style.KHTMLOpacity!="undefined"){F.style.KHTMLOpacity=C/100}}}}}};function addEvent(D,C,B,A){if(D.addEventListener){D.addEventListener(C,B,A);return true}if(D.attachEvent){return D.attachEvent("on"+C,B)}D["on"+C]=B;return false}curvyObject.getComputedColour=function(E){var F=document.createElement("DIV");F.style.backgroundColor=E;document.body.appendChild(F);if(window.getComputedStyle){var D=document.defaultView.getComputedStyle(F,null).getPropertyValue("background-color");F.parentNode.removeChild(F);if(D.substr(0,3)==="rgb"){D=curvyObject.rgb2Hex(D)}return D}else{var A=document.body.createTextRange();A.moveToElementText(F);A.execCommand("ForeColor",false,E);var B=A.queryCommandValue("ForeColor");var C="rgb("+(B&255)+", "+((B&65280)>>8)+", "+((B&16711680)>>16)+")";F.parentNode.removeChild(F);A=null;return curvyObject.rgb2Hex(C)}};curvyObject.format_colour=function(A){if(A!=""&&A!="transparent"){if(A.substr(0,3)==="rgb"){A=curvyObject.rgb2Hex(A)}else{if(A.charAt(0)!=="#"){A=curvyObject.getComputedColour(A)}else{if(A.length===4){A="#"+A.charAt(1)+A.charAt(1)+A.charAt(2)+A.charAt(2)+A.charAt(3)+A.charAt(3)}}}}return A};curvyCorners.getElementsByClass=function(H,F){var E=new Array;if(F===undefined){F=document}H=H.split(".");var A="*";if(H.length===1){A=H[0];H=false}else{if(H[0]){A=H[0]}H=H[1]}var D,C,B;if(A.charAt(0)==="#"){C=document.getElementById(A.substr(1));if(C){E.push(C)}}else{C=F.getElementsByTagName(A);B=C.length;if(H){var G=new RegExp("(^|\\s)"+H+"(\\s|$)");for(D=0;D<B;++D){if(G.test(C[D].className)){E.push(C[D])}}}else{for(D=0;D<B;++D){E.push(C[D])}}}return E};if(curvyBrowser.isMoz||curvyBrowser.isWebKit){var curvyCornersNoAutoScan=true}else{curvyCorners.scanStyles=function(){function B(F){var G=/^[\d.]+(\w+)$/.exec(F);return G[1]}var E,D,C;if(curvyBrowser.isIE){function A(L){var J=L.style;if(curvyBrowser.ieVer>6){var H=J["-webkit-border-radius"]||0;var K=J["-webkit-border-top-right-radius"]||0;var F=J["-webkit-border-top-left-radius"]||0;var G=J["-webkit-border-bottom-right-radius"]||0;var M=J["-webkit-border-bottom-left-radius"]||0}else{var H=J["webkit-border-radius"]||0;var K=J["webkit-border-top-right-radius"]||0;var F=J["webkit-border-top-left-radius"]||0;var G=J["webkit-border-bottom-right-radius"]||0;var M=J["webkit-border-bottom-left-radius"]||0}if(H||F||K||G||M){var I=new curvyCnrSpec(L.selectorText);if(H){I.setcorner(null,null,parseInt(H),B(H))}else{if(K){I.setcorner("t","r",parseInt(K),B(K))}if(F){I.setcorner("t","l",parseInt(F),B(F))}if(M){I.setcorner("b","l",parseInt(M),B(M))}if(G){I.setcorner("b","r",parseInt(G),B(G))}}curvyCorners(I)}}for(E=0;E<document.styleSheets.length;++E){if(document.styleSheets[E].imports){for(D=0;D<document.styleSheets[E].imports.length;++D){for(C=0;C<document.styleSheets[E].imports[D].rules.length;++C){A(document.styleSheets[E].imports[D].rules[C])}}}for(D=0;D<document.styleSheets[E].rules.length;++D){A(document.styleSheets[E].rules[D])}}}else{if(curvyBrowser.isOp){for(E=0;E<document.styleSheets.length;++E){if(operasheet.contains_border_radius(E)){C=new operasheet(E);for(D in C.rules){if(!isNaN(D)){curvyCorners(C.rules[D])}}}}}else{curvyCorners.alert("Scanstyles does nothing in Webkit/Firefox")}}};curvyCorners.init=function(){if(arguments.callee.done){return}arguments.callee.done=true;if(curvyBrowser.isWebKit&&curvyCorners.init.timer){clearInterval(curvyCorners.init.timer);curvyCorners.init.timer=null}curvyCorners.scanStyles()}}if(typeof curvyCornersNoAutoScan==="undefined"||curvyCornersNoAutoScan===false){if(curvyBrowser.isOp){document.addEventListener("DOMContentLoaded",curvyCorners.init,false)}else{addEvent(window,"load",curvyCorners.init,false)}};