
$(function() {
	/*
	SSS.preloadimages("media/images/btn_", "home_on.png", "store_on.png",
		"stories_on.png", "lessons_on.png", "boomer_on.png",
		"company_on.png", "careers_on.png", "contact_on.png");
	SSS.menuinit();
	*/

/********************
 MINIMIZAR/MAXIMIZAR
*********************/

$(".oCarrusel ul li a").click(function () {

			$(".ampliar").hide();

			$(".oCarrusel ul li").removeClass("selected");
			$(this).parent().addClass("selected");

			var cadena = $(this).attr("name");
			var imagen = cadena.split("#");
      document.getElementById("imDestacada").src = imagen[0]+".jpg";
      if(imagen[1] == "amplia"){
				$("a.ampliar").attr("href",imagen[0]+"_big.jpg").show();
     	}
    });

deinicio();

}); // FIN $(function()

var tipos = ["small","medium","large"];
var estandar = getCookie('tipos');
if(estandar == undefined){
	//alert("primera vez");
	estandar = 3;
	}

function tipo(cual){
	estandar = cual;
	//document.body.style.fontSize=tipos[estandar];
	deleteCookie('tipos');
	setCookie('tipos', estandar, null, null);
	deinicio();
	}


function deinicio(){

		var valor = getCookie('tipos');

		switch(valor) {
			case '0':
			{
				 $("body *:not(h2)").css("font-size","10px");
				//$("head").append("<link rel='stylesheet' media='screen,projection,handheld' href='media/tipo_pequeno.css' type='text/css' />");
				}
			break
			case '1':
			{
				$("body *:not(h2)").css("font-size","12px");
				//$("head").append("<link rel='stylesheet' media='screen,projection,handheld' href='media/tipo_mediano.css' type='text/css' />");
				}
			break
			case '2':
			{
				$("body *:not(h2)").css("font-size","12px");
				$("#oContenido *:not(h2)").css("font-size","14px");

				//$("head").append("<link rel='stylesheet' media='screen,projection,handheld' href='media/tipo_grande.css' type='text/css' />");
				}
			break;
			default:
			{
				//$("body *").css("font-size","10px");
				//$("head").append("<link rel='stylesheet' media='screen,projection,handheld' href='media/tipo_pequeno.css' type='text/css' />");
				}
			break;
		}
/*
		if(valor != 'null'){
				$("head link:last").prev().remove();
		}*/
		//deleteCookie('tipos');
	}


/*********************
Controlador de errores
**********************/
//onerror=handleErr;
var txt="";
function handleErr(msg,url,l){
	txt="There was an error on this page.\n\n";
	txt+="Error: " + msg + "\n";
	txt+="URL: " + url + "\n";
	txt+="Line: " + l + "\n\n";
	txt+="Click OK to continue.\n\n";
//alert(txt);
return true;
}

/************************************************************************************/
// Cookie API  v1.0.1
// http://www.dithered.com/javascript/cookies/index.html
// maintained by Chris Nott (chris@NOSPAMdithered.com - remove NOSPAM)


// Write a cookie value
function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + '=' + escape(value) + ((expires) ? '; expires=' + expires.toGMTString() : '') + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + ((secure) ? '; secure' : '');
	document.cookie = curCookie;
}


// Retrieve a named cookie value
function getCookie(name) {
	var dc = document.cookie;

	// find beginning of cookie value in document.cookie
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	}
	else begin += 2;

	// find end of cookie value
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) end = dc.length;

	// return cookie value
	return unescape(dc.substring(begin + prefix.length, end));
}


// Delete a named cookie value
function deleteCookie(name, path, domain) {
	var value = getCookie(name);
	if (value != null) document.cookie = name + '=' + ((path) ? '; path=' + path : '') + ((domain) ? '; domain=' + domain : '') + '; expires=Thu, 01-Jan-70 00:00:01 GMT';
	return value;
}


// Fix Netscape 2.x Date bug
function fixDate(date) {
	var workingDate = date;
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0) workingDate.setTime(workingDate.getTime() - skew);
	return workingDate;
}


// Test for cookie support
function supportsCookies(rootPath) {
	setCookie('checking_for_cookie_support', 'testing123', '', (rootPath != null ? rootPath : ''));
	if (getCookie('checking_for_cookie_support')) return true;
	else return false;
}