// 
//  n e s t O r ( function.js @ bungalows-princess.com[ v2 ] )
//  creado bajo el techo de __perceptive-studio__ el 2009-06-03
//  nestor arroba perceptive guion studio punto com
//  habiendo dicho eso, bienvenido a mi codigo
// 


/*
- <script type="text/javascript" charset="utf-8">banner('rutaNombre',ancho,alto)</script> 
*/
function banner(rutaNombre,ancho,alto) {
	// document.write('<object type="application/x-shockwave-flash" data="' + rutaNombre + '.swf" width="' + ancho + '" height="' + alto + '"><param name="movie" value="' + rutaNombre + '.swf"><param name="quality" value="high"><img src="' + rutaNombre + '.png" width="' + ancho + '" height="' + alto + '" alt="El archivo flash no se pudo cargar"></object>')
	return '<object type="application/x-shockwave-flash" data="' + rutaNombre + '.swf" width="' + ancho + '" height="' + alto + '"><param name="movie" value="' + rutaNombre + '.swf"><param name="quality" value="high"><img src="' + rutaNombre + '.png" width="' + ancho + '" height="' + alto + '" alt="El archivo flash no se pudo cargar"></object>'
}

function fixHeight() {
	hWin = document.documentElement.clientHeight; // alto ventana navegador
	hBase = document.getElementById('base').offsetHeight; // alto contenido base de mi sitio "base"
	basePadding_top = 20;
	basePadding_bottom = 20;
	hNewBase = hWin - (basePadding_top + basePadding_bottom);
	if (hBase < hWin) document.getElementById('base').style.height = hNewBase + "px";
}

function header() {
	rand = Math.floor(Math.random() * 11) + 1;
	$("#hLeft").html('<img src="" />');
	$("#hLeft img").fadeIn('slow').attr({src: '/img/header/' + rand +'.jpg'});
}

function loadImg(arg) {
	$("#hLeft").html('<img src="" />');
	$("#hLeft img").fadeIn('slow').attr({src: '/img/header/' + arg +'.jpg'});
}

function view360(archivo,ubicacion) {
	// $('div.desc p.control360:hidden').slideDown('slow');
	// $(".desc #descBanner_1").toggle(); return false;

	// $('.desc #descBanner_1').hide(400);
	// $('.desc #descBanner_11').show(400);
	$('#descBanner_' + ubicacion).html(banner('/swf/' + archivo,560,250));
}

function extLink() {
	if ( !document.getElementsByTagName ) { return; }
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if ( anchor.getAttribute("href") && anchor.getAttribute("rel") == "external" ) {
			anchor.target = "_blank";
		}
	}
}

// ======================================= JQUERY CODE =======================================
$(function() {
	$('#gallery_set a').lightBox();
	$('#map a').lightBox();
	$('#col1Cont a').lightBox();
});

$(document).ready(function() {
	fixHeight();
	header();
	extLink();
});
