var newwin;

function MM_openBrWindow(theURL,winName,features) { 
  newwin = window.open(theURL,winName,features);
  setTimeout('newwin.focus();',250);
}

function tmt_fullscreen(url,name,features) {
	var larg_schermo = screen.availWidth - 10;
  var altez_schermo = screen.availHeight - 30;
  newwin = window.open(url, name, "width=" + larg_schermo + ",height=" + altez_schermo + features);
	if (newwin != null) setTimeout('newwin.focus();',250);
}

function Abreventana(url,name,features){
 if (screen.height > '768'){
   MM_openBrWindow(url,name,features);
 }
 else{
   tmt_fullscreen(url,name,features);
 }
} 

function MM_swapImgRestore() { 
  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_swapImage() { 
  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_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 getCookie(name){
	var cname = name + "=";
	var dc = document.cookie;
	if (dc.length > 0) {
		begin = dc.indexOf(cname);
		if (begin != -1) {
			begin += cname.length;
			end = dc.indexOf(";", begin);
			if (end == -1) end = dc.length;
				return unescape(dc.substring(begin, end));
		}
	}
	return null;
}

function setCookie(name, value, expires, path, domain, secure) {
	document.cookie = name + "=" + escape(value) +
	((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
	((domain == null) ? "" : "; domain=" + domain) +
	((path == null) ? "" : "; path=" + path) +
	((secure == null) ? "" : "; secure");
	return value;
	// document.location.href = 'index_' + escape(value) + '.htm';
}

function existsCookie(nom)
{
	if (document.cookie.length > 0)       // Hay alguna cookie?
  	{
    debut = document.cookie.indexOf('navidad');
    
	if (debut != -1)                    // Existe la Cookie en cuestion?
    {
      return 1;
    }
    else {return 0;};
  }else {return 0;}
}

var idioma = getCookie('idioma');;
var pais = getCookie('pais');
var europeo = getCookie('europeo');
if (idioma == null || idioma == '') { idioma = "e";  }
if (pais == null || pais == '') { pais =  "999"; }
if (europeo == null || europeo == '') { europeo =  "N"; }

var id = '';
if (idioma == 'es')	{	id = 'ES';	}
if (idioma == 'al')	{	id = 'AL';	}
if (idioma == 'fr')	{	id = 'FR';	}
if (idioma == 'in')	{	id = 'IN';	}
if (idioma == 'ca')	{	id = 'CA';	}

var caduca;
var validez = 30;
var caduca = new Date();
caduca.setTime(caduca.getTime() + (validez*24*60*60*1000));

function elboton(){
	MM_openBrWindow('http://www.mangofashionawards.com', 'fahionAwards', '');
}

function copyright(){
	// MM_openBrWindow('http://www.mango.com/'+idioma+'/copyright.htm','copyright','width=400,height=500,scrollbars=yes');
	var url = '../'+idioma+'/copyright.htm';
	loadSection(url,false,'<%=pais%>','<%=europeo%>','<%=tarifa%>','<%=seccion%>','<%=contacto%>','','<%=idioma%>', 0, 0);
}

function mango(){
	document.location.replace('http://www.mango.com/paisesRedirect.asp?idioma='+idioma+'&pais='+pais+'&europeo='+europeo+'opcion=abierto');
}

function news(){
	// MM_openBrWindow('http://news.mango.com','news',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0');
	switch(idioma){
  	case "es":
		MM_openBrWindow('http://news.mango.com/?lang=es','news',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0');
   	break;
  	case "ca":
   	MM_openBrWindow('http://news.mango.com/?lang=ca','news',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0');
   	break;
  	case "al":
   	MM_openBrWindow('http://news.mango.com/?lang=de','news',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0');
   	break;
  	case "in":
   	MM_openBrWindow('http://news.mango.com/?lang=en','news',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0');
   	break;
  	case "fr":
   	MM_openBrWindow('http://news.mango.com/?lang=fr','news',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0');
   	break;
  	default:
   	MM_openBrWindow('http://news.mango.com/?lang=en','news',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0');
 }
}

function master(){
	MM_openBrWindow('http://www.master.esdi.es/gestion/portada.htm','esdi',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0');
}
function jobs() {
	top.document.location.replace('http://wwwnew.mango.com/oi/index.html?alias=../oi/job/'+idioma+'/index.htm?branch=trabajarmango');
}
function tiendas() {
	top.document.location.replace('http://wwwnew.mango.com/paisesRedirect.asp?pagina=tiendas');
}
function franquicias(){
		var url;
		top.document.location.replace('http://wwwnew.mango.com/paisesRedirect.asp?pagina=franquicias');
}
function tarjeta() {

        top.document.location.replace('http://wwwnew.mango.com/oi/index.html?alias=../oi/servicios/tarjeta/'+pais+'/tarjeta.htm?branch=tarjetamango&load=tarjetamango');
}
function taregalo(){
	top.document.location.replace('http://www.mango.com/paisesRedirect.asp?pagina=tarjeta_regalo');
}
function faqscontacto() {
	var url = '../'+idioma+'/faqs.htm';
	loadSection(url,false,'','','','','','','','','','', 0, 0);
}
function catalogo() {
	top.document.location.replace('http://www.mango.com/paisesRedirect.asp?pagina=catalogo');
}
function youtube(){
	Abreventana('http://www.youtube.com/mangofashion','MangoFashion',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1024,height=768,left=0,top=0');
}
function empresa(){
	top.document.location.replace('http://wwwnew.mango.com/oi/index.html?alias=../oi/servicios/company/'+idioma+'/index.htm?branch=trabajarmango');
}

function shoponline(){
  Abreventana('http://www.mangoshop.com/redirect.faces?idioma='+id+'&pais='+pais+'&id=SHP_098P_MNGSHOPONLINE&op=HOME','Mangoshop',',toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=500,left=0,top=0');
}
function mapa(){
  var plano = window.open('http://www.mango.com/oi/servicios/'+idioma +'/plano_palau.htm','plano','scrollbars=yes,resizable=yes,width=780,height=850,left=0,top=0');
	plano.focus();
}
function registro(){
	MM_openBrWindow('http://www.mangoshop.com/registro/webLogin.faces?load=registro&idioma='+id+'&pais='+pais,'registro','scrollbars=no,width=780,height=540,status=yes');
}

function registrohe(){
	MM_openBrWindow('http://www.mangoshop.com/registro/webLogin.faces?load=registro&idioma='+id+'&pais='+pais+'&genero=h','registro','scrollbars=no,width=780,height=540,status=yes');
}

function formatcliente(){
	if (pais == '400') { MM_openBrWindow('http://www.mango.com/formulari/form_usa.asp','formatcliente','scrollbars=yes,width=560,height=540'); }
	else if(pais == '052'){ MM_openBrWindow('http://www.mango.com/formulari/formshop_tk.asp','formatcliente','scrollbars=yes,width=560,height=540'); }	
	else if(pais == '720'){ MM_openBrWindow('http://www.mango.com/formulari/form_in.asp','formatcliente','scrollbars=yes,width=560,height=540'); }
	else if(pais == '075'){ MM_openBrWindow('http://www.mango.com/formulari/form_in.asp','formatcliente','scrollbars=yes,width=560,height=540'); }
	else { MM_openBrWindow('http://www.mango.com/formulari/form_'+idioma+'.asp','formatcliente','scrollbars=yes,width=560,height=540'); }
}
function formatclienteChat(){
	if (pais == '400') { MM_openBrWindow('http://www.mango.com/formulari/form_usa.asp?proc=EC','formatcliente','scrollbars=yes,width=560,height=540'); }
	else if(pais == '052'){ MM_openBrWindow('http://www.mango.com/formulari/formshop_tk.asp','formatcliente','scrollbars=yes,width=560,height=540'); }
	else if(pais == '720'){ MM_openBrWindow('http://www.mango.com/formulari/form_in.asp','formatcliente','scrollbars=yes,width=560,height=540'); }
	else if(pais == '075'){ MM_openBrWindow('http://www.mango.com/formulari/form_in.asp','formatcliente','scrollbars=yes,width=560,height=540'); }
	else { MM_openBrWindow('http://www.mango.com/formulari/form_'+idioma+'.asp?proc=EC','formatcliente','scrollbars=yes,width=560,height=540'); }
}
function lista(){
 	switch(idioma){
  	case "es":
   	tmt_fullscreen('http://jobs.mango.com/candidato/ofertas/mapa/mapa_ofertas.asp?id_idioma=1','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	case "ca":
   	tmt_fullscreen('http://jobs.mango.com/candidato/ofertas/mapa/mapa_ofertas.asp?id_idioma=5','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	case "al":
   	tmt_fullscreen('http://jobs.mango.com/candidato/ofertas/mapa/mapa_ofertas.asp?id_idioma=4','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	case "in":
   	tmt_fullscreen('http://jobs.mango.com/candidato/ofertas/mapa/mapa_ofertas.asp?id_idioma=2','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	case "fr":
   	tmt_fullscreen('http://jobs.mango.com/candidato/ofertas/mapa/mapa_ofertas.asp?id_idioma=3','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	default:
   	MM_openBrWindow('http://jobs.mango.com/candidato/ofertas/mapa/mapa_ofertas.asp?id_idioma=2','CV','menubar=no,scrollbars=yes,resizable=yes,width=780,height=540');
 }
}
function enviar(){
 	switch(idioma){
  	case "es":
   	tmt_fullscreen('http://jobs.mango.com/default.asp?id_idioma=1','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	case "ca":
   	tmt_fullscreen('http://jobs.mango.com/default.asp?id_idioma=5','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	case "al":
   	tmt_fullscreen('http://jobs.mango.com/default.asp?id_idioma=4','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	case "in":
   	tmt_fullscreen('http://jobs.mango.com/default.asp?id_idioma=2','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	case "fr":
   	tmt_fullscreen('http://jobs.mango.com/default.asp?id_idioma=3','CV','menubar=no,scrollbars=yes,resizable=yes');
   	break;
  	default:
   	tmt_fullscreen('http://jobs.mango.com/default.asp?id_idioma=2','CV','menubar=no,scrollbars=yes,resizable=yes');
 }
}
function sitemap() {
	document.location.replace('../'+idioma+'/sitemap.htm');
}
function formatclienteUsa() {
	MM_openBrWindow('http://www.mango.com/formulari/form_usa.asp','formatcliente','scrollbars=yes,width=560,height=540');
}
function inquiero(){ 
	var w=window.open('http://www.inquiero.com/inquiero/anonymous2.asp?login=2865&cat=espanol&cob=1&lang=es&ref=Pagina_tarjeta_Mango.com&ref2=ES_<%=pais%>&mode=1&bgcolor=cccccc&button=botonmng_es&SUR=Calidad_servicio','WebAnonym','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=468,height=286,top=150,left=200');
}
function devShop(){
	Abreventana('http://www.mangoshop.com/redirect.faces?id=SHP_098P_MNGATCLIDEV&op=ayuda&seccion=cambios_y_devol','shop',',scrollbars=yes,toolbar=yes,menubar=yes,locationbars=yes,left=0,top=0');
}

