/* ---------- detect browser ---------- */
//from http://javascriptkit.com/javatutors/navigator.shtml
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 if (ieversion>=8) var browser = "ie8";
 else if (ieversion>=7) var browser = "ie7";
 else if (ieversion>=6) var browser = "ie6";
 else if (ieversion>=5) var browser = "ie5";
 //document.write(browser);
}





function submitformsign()
	{
	var formularz = document.forms.form_sign;
	if (formularz.user.value == '' || formularz.pass.value == '' || formularz.pass2.value == '' || formularz.email.value == '')
		{
		alert ("Check: \n Username \n Passwords \n E-mail");
		}
		else
		{
		document.form_sign.submit();
		}
	return false;
	}
	
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
	limitField.value = limitField.value.substring(0, limitNum);
	} else {
	limitCount.value = limitNum - limitField.value.length;
	}
}




var currentCookieValue = "one";
/* ---------- jQuery stuff -------------- */
$(document).ready(function()
	{
		
	//To toggle the truncated / full description on details page (property.tpl)
    $("#showFullDescription").click(function ()
		{
		$("#truncatedDescription").hide();
		$("#fullDescription").show();
		return false;
    	});
	$("#showTruncatedDescription").click(function ()
		{
		$("#fullDescription").hide();
		$("#truncatedDescription").show();
		return false;
    	});
	
	//color the My Properties on rollover / rollout
	/*
	$(".myProperties").mouseover(function()
		{
		$(this).css('background-color','#dedede');
		$(this).find('.header').css('background-color','#cccccc');
		});
	$(".myProperties").mouseout(function()
		{
		$(this).css('background-color','#ededed');
		$(this).find('.header').css('background-color','#dedede');
		});
	*/


	/* ---------- qTips  ----------*/
	
	$('.info1[title]').qtip({
      position: { corner: { target: 'topMiddle', tooltip: 'bottomMiddle' } },
      style: { background: '#ffffff', color: '#666666', padding: '7px 13px', border: { width: 2, color: '#fb4848'}, width: { max: 210, min: 0 }, 'font-size': '12px' , tip: true }
   });
	
	$('#noFavourites').qtip({
      content: '<p>You don\'t have any favourites yet</p>',
	  when: { event: 'mouseclick' },
	  position: { corner: { target: 'bottomMiddle', tooltip: 'topMiddle' } },
      style: { background: '#ffffff', color: '#666666', padding: '7px 13px', border: { width: 2, color: '#fb4848'}, width: { max: 210, min: 0 }, 'font-size': '12px' , tip: true }
   });
	
	
	/* ---------- Add to Favourites cookie maker ----------*/
	$('.cookieMaker').click(function()
		{
		//var propertyID = {$id_obiekt};//this comes from overall-header.tpl
		var dash = "-";//so we can kill the dash later if it isn't necessary
		var cookieName = 'favourites';//name the cookie
		var currentCookieValue = $.cookie(cookieName);//get the current cookie value
		var alreadyExists = false;//set already exists to false as the default
		if(currentCookieValue!=null)//if a cookie is set
			{
			var cookieArray = currentCookieValue.split("-");//split the cookie into an array
			for ( var i=0, len=cookieArray.length; i<len; ++i )//loop through the array
				{
				if(propertyID==cookieArray[i])//if the property already exists in the cookie
					{
					if($('.cookieMaker').data("qtip")) $('.cookieMaker').qtip("destroy");//Destroy current tooltip
					$('.cookieMaker').qtip({//Create new tooltip
						content: '<p style="text-align:center;">This property (#'+propertyID+') is already in your favourites <br /><a href="/my_favourites" class="qTip">View your favourites here &gt;&gt;</a></p>',
						show: { when: false, ready: true },
						hide: { when: { event: 'unfocus' } },
						position: { corner: { target: 'topMiddle', tooltip: 'bottomMiddle' } },
				  style: { background: '#ffffff', color: '#666666', padding: '10px 10px', border: { width: 2, color: '#fb4848'}, width: { max: 200, min: 0 }, tip: true }
						});//end qTip
					return false; //so it isn't added again (so the rest of the script doesn't run)
					}// end inner if
				}//end for
			}//end if
		//it'll keep running and add the property if this doesn't already exist in the cookie
		if(currentCookieValue==null || currentCookieValue=="") { currentCookieValue=""; dash=""; }//so the dash doesn't show if this is 1st added property
		var cookieValue = currentCookieValue+dash+propertyID;//set the cookie value
		$.cookie(cookieName, null, { path: '/', expires: 365 });//clear the old cookie
		$.cookie(cookieName, cookieValue, { path: '/', expires: 365 });//create the new cookie
        
        if($('.cookieMaker').data("qtip")) $('.cookieMaker').qtip("destroy");//Destroy current tooltip
		$('.cookieMaker').qtip({//Create new tooltip
			content: '<p style="text-align:center;">This property (#'+propertyID+') has been added to your favourites <br /><a href="/my_favourites" class="qTip">View your favourites here &gt;&gt;</a></p>',
			show: { when: false, ready: true },
			hide: { when: { event: 'unfocus' } },
			position: { corner: { target: 'topMiddle', tooltip: 'bottomMiddle' } },
      style: { background: '#ffffff', color: '#666666', padding: '10px 10px', border: { width: 2, color: '#fb4848'}, width: { max: 200, min: 0 }, tip: true }
			});//end qTip
		return false;//so the # isn't added to the url
		});//end cookieMaker click
	/* ---------- end Add to Favourites cookie maker ----------*/
		
		
	/* ---------- Remove from Favourites cookie deleter ----------*/
	$('.cookieDeleter').click(function()
		{
		var confirmed = confirm('Are you sure you want to remove this from your list of favourites?');
		if(confirmed)
			{
			var propertyID = this.id;
			var cookieName = 'favourites';//name the cookie
			var currentCookieValue = $.cookie(cookieName);//get the current cookie value
			var cookieArray = currentCookieValue.split("-");//split the cookie into an array
			for ( var i=0, len=cookieArray.length; i<len; ++i )//loop through the array
				{
				if(propertyID==cookieArray[i])//if the property already exists in the cookie
					{
					var cookieToDelete = i;
					}//end if
				}//end for
			var newCookieValue = "";
			var dash = "";
			for ( var i=0, len=cookieArray.length; i<len; ++i )//loop through the array
				{
				if(cookieToDelete!=i)
					{
					var newCookieValue = newCookieValue + dash + cookieArray[i];
					dash = "-";
					}
				}//end for
			var cookieValue = newCookieValue;//set the cookie value
			$.cookie(cookieName, null, { path: '/', expires: 365 });//clear the old cookie
			if(cookieValue!=null) $.cookie(cookieName, cookieValue, { path: '/', expires: 365 });//create the new cookie
			if(len<=2) $('.addBreaksIfNecessary').append("<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />");
			var dad = $(this).parent().parent().parent().parent().parent();//gets the surrounding div
			dad.slideUp(function()
				{
				if(len==1) $('.addBreaksIfNecessary').prepend("<strong>You don't yet have any favourites</strong>");
				});
			}//end if confirmed
		return false;//so the # isn't added to the url
		});//end cookieDeleter click
		/* ---------- end Add to Favourites cookie deleter ----------*/
	
	});//end document ready function



function doSearch()
{
	//console.log( getSearchUrl());
	document.location = getSearchUrl();
	return false;
}

function getSearchUrl()
{
        //This function controls the SEARCH forms and builds the appropriate query strings.
        query = '';
        url = '/luxury-rentals-search';

        if( document.search_term.searchTextInput.value && document.search_term.searchTextInput.value!='Keyword / Property # Search')
                query += '/terms-' + encodeURIComponent( document.search_term.searchTextInput.value.replace( / /g,'-' ) );

        if( undefined !== document.search_advanced )
        {
                if( document.search_advanced.city_name.value )
                        url = '/luxury-rentals-search/' + encodeURIComponent( document.search_advanced.city_name.value.replace( / /g,'-' ) ) ;
                if( document.search_advanced.type.value )
                        url += '/' + encodeURIComponent( document.search_advanced.type.value ) ;

                if( document.search_advanced.virtual_only.checked )
                        query += '/virtual-tours';

                if( document.search_advanced.price_low.value || document.search_advanced.price_high.value ){
                        low = parseInt( document.search_advanced.price_low.value );
                        high = parseInt( document.search_advanced.price_high.value );
                        if( !low )
                                low = 0;
                        if( !high )
                                high = 50000;
                        query += '/$' + low + '-$' + high;
                }
                if( document.search_advanced.beds_low.value || document.search_advanced.beds_high.value ){
                        low = parseInt( document.search_advanced.beds_low.value );
                        high = parseInt( document.search_advanced.beds_high.value );
                        if( !low )
                                low = 0;
                        if( !high )
                                high = 9;
                        query += '/' + low + '-' + high;
                }
                if( document.search_advanced.venue && document.search_advanced.venue.value ){
                        query += '/venue-' + encodeURIComponent( document.search_advanced.venue.value );
                        if( document.search_advanced.venue_distance && document.search_advanced.venue_distance.value )
                                query += '-' + encodeURIComponent( document.search_advanced.venue_distance.value );
                }
        }

        return url + query;

}




/* ---------- SMOOTH #TOP LINKS WITH JQUERY ---------- */
/*$(function()
	{
    $('a[href*=#]').click(function()
		{
    	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname)
			{
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length)
				{
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                return false;
				}
			}
		});
	}); */

	
	
/* ---------- VALIDATE STICKY LOG IN ---------- */
function submitformtoplogin()
	{
	//DOESN"T MATTER ANYMORE!
	return true;
	var formularz = document.forms.toplogin;
	if (formularz.logas[0].checked == false && formularz.logas[1].checked == false)
		{
		alert ("Please select login type (Owner or Traveller)");
		return false;
		}
	else
		{
		return true;
		//document.form_login.submit();
		}
}

	
	
	
	
	/* ---------- FEATURED PROPERTY rotation ---------- */
	$(document).ready(function() { 
		$('#image_rotate').innerfade({ 
			speed: 1500, 
			timeout: 4000, 
			type: 'sequence', 
			containerheight: '146px'
		});
	});
	
	/* ---------- AVAILABLE PROPERTIES rollover function ---------- */
	var currentOnDiv2 = 'div#availableSurrounding1';
	var currentlyRunning2 = false;
	var nextOnDiv2;
	var theOnDiv2;
	var theOnCountryName2;
	doStuff2 = function(theOnDiv2, theOnCountryName2)
		{
		if( theOnDiv2 == currentOnDiv2 ) /* if the hovered div is already showing */
			{
			// do nothing
			
			}
		else if( currentlyRunning2 == true) /* if function is currently running and another is hovered */
			{
			nextOnDiv2 = theOnDiv2;
			setTimeout("doStuff2(nextOnDiv2)",700);
			}
		else /* do it */
			{
			currentlyRunning2 = true;
			$(currentOnDiv2).fadeOut("fast",function()
				{
				$(theOnDiv2).fadeIn("fast",function()
					{
					 currentOnDiv2 = theOnDiv2;
					 currentlyRunning2 = false;
					 });
				});
			}//end else
		}//end doStuff function
	
	

	/* ---------- AVAILABLE PROPERTIES rollover function ---------- */
	var currentOnDiv = 'div#availableProperty1';
	var currentlyRunning = false;
	var nextOnDiv;
	var theOnDiv;
	var theOnCountryName;
	doStuff = function(theOnDiv, theOnCountryName)
		{
		if(theOnDiv == currentOnDiv) /* if the hovered div is already showing */
			{
			// do nothing
			
			}
		else if(currentlyRunning == true) /* if function is currently running and another is hovered */
			{
			nextOnDiv = theOnDiv;
			setTimeout("doStuff(nextOnDiv)",700);
			}
		else /* do it */
			{
			currentlyRunning = true;
			$(currentOnDiv).fadeOut("fast",function()
				{
				$(theOnDiv).fadeIn("fast",function()
					{
					 currentOnDiv = theOnDiv;
					 currentlyRunning = false;
					 });
				});
			}//end else
		}//end doStuff function
		
		doMore = function(theOnCountryName)
			{
			i=0;
			while(i<7)
				{
				var countryName = ("countryName" + i);
				var imageName = ("availablePropertyImg" + i);
				if(countryName!=theOnCountryName) // hide all that we aren't on
					{
					document.getElementById(countryName).style.display = 'none';
					document.getElementById(imageName).style.marginTop = '4px';
					document.getElementById(imageName).style.borderTop = 'none';
					document.getElementById(imageName).style.borderBottom = 'none';
					}
				else // show the on we're on 
					{
					document.getElementById(theOnCountryName).style.display = 'block';
					document.getElementById(imageName).style.marginTop = '2px';
					document.getElementById(imageName).style.borderTop = 'solid 2px #336699';
					document.getElementById(imageName).style.borderBottom = 'solid 2px #336699';
					}
				i++;
				}
			
			}

		



/* ---------- to show/hide forms and FAQ answers ---------- */

    
	
	//forms
	function doSignUpForm(child, parent){
        var theChild = document.getElementById(child);
		var theParent = document.getElementById(parent);
        if ( theChild.style.display == 'none' ) {
            if (document.all) {
                theChild.style.display = 'block';
				theParent.style.borderBottom = '0';
				//theParent.style.borderBottom = 'dotted 1px #88adc8';
				
            } else {
                theChild.style.display = '';
				theParent.style.borderBottom = '0';
				//theParent.style.borderBottom = 'dotted 1px #88adc8';
				
            }
        } else {
            theChild.style.display = 'none';
			theParent.style.borderBottom = 'solid 1px #88adc8';
        }
    }

function doFrontBox(child){
	var theChild = document.getElementById(child);
	var i = 1;
	document.getElementById("boxDefault").style.display = 'none';
	while(i<4) {
		document.getElementById("boxChild"+i).style.display = 'none'; // hide children
		i++;
	}

	if (document.all) {
		theChild.style.display = 'block';
	} else {
		theChild.style.display = '';
	}
}
	
	
	//faq
	function doFaq(child, parent){
        var theChild = document.getElementById(child);
		var theParent = document.getElementById(parent);
        if ( theChild.style.display == 'none' ) {
            if (document.all) {
                theChild.style.display = 'block';
				theParent.style.borderBottom = '0';
				theParent.style.border = 'solid 1px #88adc8';
				theParent.style.borderBottom = '0';
				
            } else {
                theChild.style.display = '';
				theParent.style.borderBottom = '0';
				theParent.style.border = 'solid 1px #88adc8';
				theParent.style.borderBottom = '0';
				
            }
        } else {
            theChild.style.display = 'none';
			theParent.style.border = 'solid 1px white';
        }
    }
	
	
	//destination reviews
	function doDestinationReview(child, parent){
        var theChild = document.getElementById(child);
		var theParent = document.getElementById(parent);
        if ( theChild.style.display == 'none' ) {
			var i = 1;
			while(i<4)//loop through to hide everything first
				{
				document.getElementById("destChild"+i).style.display = 'none'; // hide children
				//document.getElementById("destParent"+i).style.backgroundColor = ''; // reset parents
				//document.getElementById("destParent"+i).style.color = ''; // reset parents
				i++;
				}
			if (document.all) { //show
				theChild.style.display = 'block'; // show the clicked child
				theParent.style.backgroundColor = '#336699';
				theParent.style.color = 'white';
            } else { //show
                theChild.style.display = ''; // show clicked the child
				theParent.style.backgroundColor = '#336699';
				theParent.style.backgroundColor = '#336699';
				theParent.style.color = 'white';
            }
        } else { //hide
            theChild.style.display = 'none'; //hide the children
			theParent.style.backgroundColor = '';
			theParent.style.color = '';
			
			//theParent.style.border = 'solid 1px white';
        }
    }
	
	
	
	//traveller/owner log in (masthead)
	function doLogIn(child, parent){
        var theChild = document.getElementById(child);
		var theParent = document.getElementById(parent);
        if ( theChild.style.display == 'none' ) {
			var i = 1;
			while(i<6)//loop through to hide everything first
				{
				document.getElementById("stickyChild"+i).style.display = 'none'; // hide children
				document.getElementById("stickyParent"+i).style.backgroundColor = ''; // reset parents
				document.getElementById("stickyParent"+i).style.color = ''; // reset parents
				i++;
				}
			if (document.all) { //show ie
				theChild.style.display = 'block'; // show the clicked child
				theChild.style.backgroundColor = '#48af6a'; // show the clicked child
				theParent.style.color = 'white';
            } else { //show ffox
                theChild.style.display = 'block'; // show the clicked child
				theChild.style.backgroundColor = '#7298b4'; // show clicked the child
				theParent.style.color = 'white';
				//theParent.style.backgroundColor = 'white';
            }
        } else { //hide
            theChild.style.display = 'none'; //hide the children
			theChild.style.backgroundColor = ''; //hide the children
			theParent.style.color = '';
        }
    }






// * ---------- The Image Preloadeer and Swap Image / Swap Image Restore Functions ---------- */

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 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;
}





/* ---------- The  2007/2008  2008/2009  Price Switching Function ---------- */

// tab functions
lastTab = 'tab1';
lastTabBottom = 'tab3';

function show(layerName) { 
	document.getElementById(layerName).style.display = '';
	//return 'background-image:url(./images/ltab_blue.gif);';
} 

function hide(layerName) { 
	document.getElementById(layerName).style.display = 'none';
	//return 'background-image:url(./images/ltab_blue.gif);';
}	
function showNext(tabName) {
	if(document.getElementById(lastTab)){
		document.getElementById(lastTab).className = 'tab'
	}
	var curr = document.getElementById(tabName);
	curr.className='tabHover';
	hide(lastTab+'Data');
	show(tabName+'Data');
	lastTab=tabName;
}
function showNext2(tabName) {
	if(document.getElementById(lastTabBottom)){
		document.getElementById(lastTabBottom).className = 'tabBottom'
	}
	var curr = document.getElementById(tabName);
	curr.className='tabHoverBottom';
	hide(lastTabBottom+'Data');
	show(tabName+'Data');
	lastTabBottom=tabName;
}






/* ---------- The Show/Hide Layer Functions ---------- */

// <script>

// Copyright (C) 2005 Ilya S. Lyubinskiy. All rights reserved.
// Technical support: http://www.php-development.ru/
//
// YOU MAY NOT
// (1) Remove or modify this copyright notice.
// (2) Distribute this code, any part or any modified version of it.
//     Instead, you can link to the homepage of this code:
//     http://www.php-development.ru/javascripts/dropdown.php.
//
// YOU MAY
// (1) Use this code on your website.
// (2) Use this code as a part of another product provided that
//     its main use is not creating javascript menus.
//
// NO WARRANTY
// This code is provided "as is" without warranty of any kind, either
// expressed or implied, including, but not limited to, the implied warranties
// of merchantability and fitness for a particular purpose. You expressly
// acknowledge and agree that use of this code is at your own risk.


/* ---------- Popup Control ---------- */

function at_display(x)
{
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

// ----- Show Aux -----

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ----- Show -----

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);

  clearTimeout(c["at_timeout"]);
  
  
  /* adam's code starts here */
  
  /* to style the Tab parent */
  if(p.id=='tabMenuParent1' || p.id=='tabMenuParent2' || p.id=='tabMenuParent3' || p.id=='tabMenuParent4' || p.id=='tabMenuParent5' || p.id=='tabMenuParent6')
  	{
  	//document.getElementById(p.id).setAttribute('class','tabOn'); //setAttribute doesn't work in IE6 or 7
	document.getElementById(p.id).className = "tabOn";
	}
  
  /* to style the Recent Listings parent */
  if(p.id=='recentListingMenuParent1' || p.id=='recentListingMenuParent2' || p.id=='recentListingMenuParent3' || p.id=='recentListingMenuParent4' || p.id=='recentListingMenuParent5')
  	{
	document.getElementById(p.id).className = "recentListingMenuParentOn";
	}
  
  /* next bit of code hides the style selector when you rollover first RECENT LISTING
  this is done for two reaons:
  1. IE 6 doesn't understand z-index on selectors, so the selector was on top of the popup
  2. When fixing this for IE 6 I found this looked better for all browsers (no clutter behind the rollover) */
  if(p.id=='tabMenuParent4' || p.id=='tabMenuParent5' || p.id=='tabMenuParent6')
  	{
	if(browser=="ie6")
		{
  		$('.hideIfExplorer6').css('visibility','hidden');
		}
	}
  
  /* adam's code ends here */

}

// ----- Hide -----

function at_hide()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child"]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 0);  /* this was at 333 before adam edited it */
  
  
  /* -- adam's code starts here-- */
  
  /* to reset the Tab parent */
  if(p.id=='tabMenuParent1' || p.id=='tabMenuParent2' || p.id=='tabMenuParent3' || p.id=='tabMenuParent4' || p.id=='tabMenuParent5' || p.id=='tabMenuParent6')
  	{
  	document.getElementById(p.id).className = "tab";
	}
  
  /* to reset the Recent Listings parent */
  if(p.id=='recentListingMenuParent1' || p.id=='recentListingMenuParent2' || p.id=='recentListingMenuParent3' || p.id=='recentListingMenuParent4' || p.id=='recentListingMenuParent5')
  	{
  	document.getElementById(p.id).className = "recentListingMenuParent";
	}
  
  /* if this element has the second class name of tabOn, don't reset bg colour */
  if (document.getElementById(this["at_parent"]).className.indexOf("tabOn") != -1)
	{
	//no longer used, but might be in the future, so this has been left in
	}
  else /* reset bg colour */
  	{
	//no longer used, but might be in the future, so this has been left in
	}

  /* shows what was hidden (see above) */
  if(p.id=='tabMenuParent4' || p.id=='tabMenuParent5' || p.id=='tabMenuParent6')
  	{
	if(browser=="ie6")
		{
	  	$('.hideIfExplorer6').css('visibility','visible');
		}
	}
	
  /* -- adam's code ends here -- */
  
}

// ----- Click -----

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible")
       at_show_aux(p.id, c.id);
  else c.style.visibility = "hidden";

  return false;
}

// ----- Attach -----

// PARAMETERS:
// parent   - id of visible html element
// child    - id of invisible html element that will be dropdowned
// showtype - "click" = you should click the parent to show/hide the child
//            "hover" = you should place the mouse over the parent to show
//                      the child
// position - "x" = the child is displayed to the right of the parent
//            "y" = the child is displayed below the parent
// cursor   - Omit to use default cursor or check any CSS manual for possible
//            values of this field

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;
  
  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}













/* ---------- Entire absolutePopup.js script below ---------- */

/* Script by: www.jtricks.com
 * Version: 20070301
 * Latest version:
 * www.jtricks.com/javascript/window/box.html
 */
 
 
// Moves the box object to be directly beneath an object.
function move_box(an, box, cleft, ctop)
{
    //var cleft = -750; /* adam changed these ... the cleft and ctop are now changeable on a per-link basis */
    //var ctop = -200; /* adam changed */
    var obj = an;

    while (obj.offsetParent)
    {
        cleft += obj.offsetLeft;
        ctop += obj.offsetTop;
        obj = obj.offsetParent;
    }

    box.style.left = cleft + 'px';

    ctop += an.offsetHeight + 8;

    // Handle Internet Explorer body margins,
    // which affect normal document, but not
    // absolute-positioned stuff.
    if (document.body.currentStyle &&
        document.body.currentStyle['marginTop'])
    {
        ctop += parseInt(
            document.body.currentStyle['marginTop']);
    }

    box.style.top = ctop + 'px';
}

// Shows a box if it wasn't shown yet or is hidden
// or hides it if it is currently shown
function show_hide_box(an, width, height, borderStyle, cleft, ctop)
{
    var href = an.href;
    var boxdiv = document.getElementById(href);

    if (boxdiv != null)
    {
        if (boxdiv.style.display=='none')
        {
            // Show existing box, move it
            // if document changed layout
            move_box(an, boxdiv);
            boxdiv.style.display='block';

            bringToFront(boxdiv);

            // Workaround for Konqueror/Safari
            if (!boxdiv.contents.contentWindow)
                boxdiv.contents.src = href;
        }
        else
            // Hide currently shown box.
            boxdiv.style.display='none';
        return false;
    }

    // Create box object through DOM
    boxdiv = document.createElement('div');

    // Assign id equalling to the document it will show
    boxdiv.setAttribute('id', href);

    boxdiv.style.display = 'block';
    boxdiv.style.position = 'absolute';
    boxdiv.style.width = width + 'px';
    boxdiv.style.height = height + 'px';
    boxdiv.style.border = borderStyle;
	boxdiv.style.borderColor = '#cccccc';
    boxdiv.style.textAlign = 'right';
    boxdiv.style.padding = '4px';
    boxdiv.style.background = '#FFFFFF';
    document.body.appendChild(boxdiv);

    var offset = 0;

    // Remove the following code if 'Close' hyperlink
    // is not needed.
    var close_href = document.createElement('a');
    close_href.href = 'javascript:void(0);';
	close_href.style.color = '#990000';
	close_href.style.fontSize = '.8em';
	close_href.style.textDecoration = 'underline';
	close_href.style.paddingRight = '10px';
    close_href.onclick = function()
        { show_hide_box(an, width, height, borderStyle); }
    close_href.appendChild(document.createTextNode('Close Window'));
    boxdiv.appendChild(close_href);
    offset = close_href.offsetHeight;
    // End of 'Close' hyperlink code.

    var contents = document.createElement('iframe');
    //contents.scrolling = 'no';
    contents.overflowX = 'hidden';
    contents.overflowY = 'scroll';
    contents.frameBorder = '0';
    contents.style.width = width + 'px';
    contents.style.height = (height - offset) + 'px';

    boxdiv.contents = contents;
    boxdiv.appendChild(contents);

    move_box(an, boxdiv, cleft, ctop);

    if (contents.contentWindow)
        contents.contentWindow.document.location.replace(
            href);
    else
        contents.src = href;

    // The script has successfully shown the box,
    // prevent hyperlink navigation.
    return false;
}

function getAbsoluteDivs()
{
    var arr = new Array();
    var all_divs = document.body.getElementsByTagName("DIV");
    var j = 0;

    for (i = 0; i < all_divs.length; i++)
        if (all_divs.item(i).style.position=='absolute')
        {
            arr[j] = all_divs.item(i);
            j++;
        }

    return arr;
}

function bringToFront(obj)
{
    if (!document.getElementsByTagName)
        return;

    var divs = getAbsoluteDivs();
    var max_index = 0;
    var cur_index;

    // Compute the maximal z-index of
    // other absolute-positioned divs
    for (i = 0; i < divs.length; i++)
    {
        var item = divs[i];
        if (item == obj ||
            item.style.zIndex == '')
            continue;

        cur_index = parseInt(item.style.zIndex);
        if (max_index < cur_index)
        {
            max_index = cur_index;
        }
    }

    obj.style.zIndex = max_index + 1;
}

/* ---------- End Entire absolutePopup.js script below ----------*/





