// LINK A LA CSS
function incluyeCss(css,size)
{
	if (document.all)
		document.write("<link rel=stylesheet href=css/" + css + "-" + size + ".css>");
	else
		document.write("<link rel=stylesheet href=css/" + css + "-fx.css>");
}


// FUNCION PARA ANYADIR A LA CESTA
function anyadirCesta(sigla,cantidad)
{
	if (document.all)
		valor=document.getElementById(cantidad).value;
	else
		valor=document.Form1[cantidad].value;
	numero=parseInt(valor);
	if (isNaN(numero))
		alert('La cantidad introducida no es valida')
	else
		if (numero < 1)
			alert('La cantidad introducida no es valida')
		else
			window.location = "productoComprado.aspx?sigla=" + sigla + "&cantidad=" + numero;
}

function anyadirCesta(sigla,cantidad,tipo,categoria,idioma)
{
	if (document.all)
		valor=document.getElementById(cantidad).value;
	else
		valor=document.Form1[cantidad].value;
	numero=parseInt(valor);
	if (isNaN(numero))
		if (idioma == 2)
			alert('Please enter a valid number of copies');
		else
			alert('La cantidad introducida no es valida');
	else
		if (numero < 1)
			if (idioma == 2)
				alert('Please enter a valid number of copies');
			else
				alert('La cantidad introducida no es valida');
		else
			if (tipo != 8 && tipo != 1 && tipo != 11  && tipo != 12 && tipo != 13 && tipo != 16 &&(categoria == 3 || categoria == 13 || categoria == 4 || categoria == 14))
				if (numero < 5)
					if (idioma == 2)
						alert('An order of at least 5 copies is required');
					else
						alert('Debe adquirir como minimo 5 copias');
				else
					window.location = "productoComprado.aspx?sigla=" + sigla + "&cantidad=" + numero;
			else
				window.location = "productoComprado.aspx?sigla=" + sigla + "&cantidad=" + numero;
}

// FUNCION PARA ANYADIR A LA CESTA - INTEGRACION CON INSIGHT
function anyadirCestaInt(sigla,cantidad)
{
	if (document.all)
		valor=document.getElementById(cantidad).value;
	else
		valor=document.Form1[cantidad].value;
	numero=parseInt(valor);
	if (isNaN(numero))
		alert('La cantidad introducida no es valida')
	else
		if (numero < 1)
			alert('La cantidad introducida no es valida')
		else
			window.location = "productoCompradoInt.aspx?sigla=" + sigla + "&cantidad=" + numero;			
}


// LINK A SEALEDMEDIA UNSEALER
function newWin(strURL) {
    downloadWin = window.open(strURL,'downloadWin','scrollbars,resizable,width=550,height=550');
}

//function linkUnsealer(textoLink, idioma, cssClass) {
	// default values - can be overridden by query string values
//	var customerId       = 'IESE Publishing';
//	var helpContact      = 'iesep.com';
//	var unsealerLanguage;
//	var displayLanguage;
//	var targetUrl = 'http://download.sealedmedia.com/unsealer/client_detect.asp';
//	var imageUrl  = 'http://download.sealedmedia.com/images/get_unsealer.gif';
//	
//	
//	if (idioma == 1)
//	{
//		unsealerLanguage = 'es';
//		displayLanguage  = 'es';
//	}
//	else
//	{
//		unsealerLanguage = 'en';
//		displayLanguage  = 'en';
//	}
//	
//	var strQstr   = String(window.location.search);
//	var strLink   = (strQstr.length > 1) ? strQstr : '?';
//
//	if (strQstr.indexOf('customerId') == -1)       strLink += '&customerId='  + escape(customerId);
//	if (strQstr.indexOf('helpContact') == -1)      strLink += '&helpContact=' + escape(helpContact);
//	strLink += '&unsealerLanguage=' + escape(unsealerLanguage);
//	strLink += '&displayLanguage=' + displayLanguage;
//	strLink  += '&whereFrom=' + escape(window.location.host);
//	document.write("<a href=\"javascript:newWin('" + targetUrl + strLink + "')\" class='" + cssClass + "' >" + textoLink + "</a>");
// }


// ***** CAMBIADO EL 30 ABRIL 2008
// ***** EN VEZ DE HACER LO ANTERIOR, SIMPLEMENTE ABRIMOS LA VENTANA A www.iesep.com/downloadsmen CON LA AYUDA OPCIONAL PARA
// ***** LOS USUARIOS DEL WINDOWS VISTA
function linkUnsealer(textoLink, idioma, cssClass) {
	var targetUrl = 'http://www.iesep.com/downloadsm';
	var imageUrl  = 'http://download.sealedmedia.com/images/get_unsealer.gif';
	var unsealerLanguage;
	var displayLanguage;
	
	if (idioma == 1)
	{
		unsealerLanguage = 'es';
		displayLanguage  = 'es';
	}
	else
	{
		unsealerLanguage = 'en';
		displayLanguage  = 'en';
	}

	document.write("<a href=\"javascript:newWin('" + targetUrl + unsealerLanguage + "/')\" class='" + cssClass + "' >" + textoLink + "</a>");
}