function ampliarVIP() {
	$('#vip').animate({height:"135px"},1000,function() {
		$('#vip_form').fadeIn(1000);
		$('#ctrl_vip, #ctrl_vip2').attr("href","javascript:amagarVIP();");
		$('#vip .link').removeClass("fletxa1");
		$('#vip .link').addClass("fletxa3");
	});
}

function amagarVIP() {
	$('#vip_form').fadeOut(500,function() {
		$('#vip').animate({height:"44px"},1000);
		$('#ctrl_vip, #ctrl_vip2').attr("href","javascript:ampliarVIP();");
		$('#vip .link').removeClass("fletxa3");
		$('#vip .link').addClass("fletxa1");
	});
	
}

function mostrarFormButlleti() {
	$('#link_butlleti .quadre_butlleti').addClass("obert");
	$('#q_butlleti2').animate({height:"80px"},1000,function() {
		$('#form_butlleti').fadeIn(1000);
		$('#link_butlleti').attr("href","javascript:amagarFormButlleti();");
	});
}

function amagarFormButlleti() {
	$('#link_butlleti .quadre_butlleti').removeClass("obert");
	var dis=$('#q_butlleti3').css('display');
	if (dis=='block') { $('#q_butlleti3').hide("blind", {direction:"vertical"}, 1000); }
	var hei=$('#q_butlleti2').height();
	if (hei=='80') {
		$('#form_butlleti').fadeOut(500,function() {
			$('#q_butlleti2').animate({height:"25px"},1000);
		});
	}
	$('#link_butlleti').attr("href","javascript:mostrarFormButlleti();");
}



var bn_trobat=false;
function banner_dreta() {
	if (!bn_trobat) {
		bn_trobat=true;
		alert(bn_trobat);
		$('#banner_dreta').cycle({
    		fx:    'curtainX',
    		speed: 0,
    		sync: false,
    		end: function() { bn_trobat=false; alert(bn_trobat); }
 		});
	}
}


function desplegables(ref,num,tip) {
	for(i=1;i<(num+1);i++) {
		if (i!=ref) {
			amagarDesplegable(i,tip);
		}
	}
	canviarDesplegable(ref,tip);
}

function canviarDesplegable(ref,tip) {
	var ident;
	switch (tip) {
		case "menu":
			ident='sm_'+ref;
		break;
		case "otmi":
			ident='exp_' + ref;
			ident2='mi_'+ref;
		break;
		case "sms":
			ident='sms_'+ref;
		break;
		case "ot":
		case "color":
		default:
			ident='exp_' + ref;
		break;
	}
	
	var estat = document.getElementById(ident).style.display;
	if (estat == 'block') {
		$('#'+ident).hide("blind", {direction:"vertical"}, 1000);
		if (tip=='otmi') {
			$('#'+ident2).hide("blind", {direction:"vertical"}, 1000);
			$('#qc_'+ref+' > .img_despl_ot').css('background-position', '0px');
		}
		if (tip=='ot') { $('#qc_'+ref+' > .img_despl_ot').css('background-position', '0px'); }
		else if (tip=='color') { $('#qc_'+ref+' > .img_desplegable').css('background-position', '0px'); }
		else if (tip=='menu') { $('#smenu_'+ref).removeClass("selec"); $('#smenu_'+ref+' .link2').removeClass("fletxa3"); $('#smenu_'+ref+' .link2').addClass("fletxa1"); }
	}
	else {
		$('#'+ident).show("blind", {direction:"vertical"}, 1000);
		if (tip=='otmi') {
			$('#'+ident2).show("blind", {direction:"vertical"}, 1000);
			$('#qc_'+ref+' > .img_despl_ot').css('background-position', '-29px 0px');
		}
		if (tip=='ot') { $('#qc_'+ref+' > .img_despl_ot').css('background-position', '-29px 0px'); }
		else if (tip=='color') { $('#qc_'+ref+' > .img_desplegable').css('background-position', '-29px 0px'); }
		else if (tip=='menu') { $('#smenu_'+ref).addClass("selec"); $('#smenu_'+ref+' .link2').removeClass("fletxa1"); $('#smenu_'+ref+' .link2').addClass("fletxa3"); }
	}
}
function amagarDesplegable(ref,tip) {
	var ident;
	switch (tip) {
		case "menu":
			ident='sm_'+ref;
		break;
		case "otmi":
			ident='exp_' + ref;
			ident2='mi_'+ref;
		break;
		case "sms":
			ident='sms_'+ref;
		break;
		case "ot":
		case "color":
		default:
			ident='exp_' + ref;
		break;
	}
	var estat = document.getElementById(ident).style.display;
	if (estat=='block') {
		$('#'+ident).hide("blind", {direction:"vertical"}, 1000);
		if (tip=='otmi') {
			$('#'+ident2).hide("blind", {direction:"vertical"}, 1000);
			$('#qc_'+ref+' > .img_despl_ot').css('background-position', '0px');
		}
		if (tip=='ot') { $('#qc_'+ref+' > .img_despl_ot').css('background-position', '0'); }
		else if (tip=='color') { $('#qc_'+ref+' > .img_desplegable').css('background-position', '0'); }
		else if (tip=='menu') { $('#smenu_'+ref).removeClass("selec"); $('#smenu_'+ref+' .link2').removeClass("fletxa3"); $('#smenu_'+ref+' .link2').addClass("fletxa1"); }
	}
}


function newUserNewslee(b_id,b_lang,b_visual,b_name,b_mail) {
	//http://newslee.6tems.com/newuser.php
	
	$.get('inc/newslee.php?id='+b_id+'&idioma='+b_lang+'&visual='+b_visual+'&nname='+b_name+'&nemail='+b_mail, function (data) {
		
		//alert(data);
		
		var get_cont=new Array();
		get_cont=data.split('###');
		
		$('#q_butlleti3').html(get_cont[1]);
		if (get_cont[0]=='1') {
			$('#form_butlleti').fadeOut(500,function() {
				$('#q_butlleti2').animate({height:"25px"},1000);
			});
		}
		$('#q_butlleti3').show("blind", {direction:"vertical"}, 1000);
	});
	
}




