function getElmById(aID){
	var element = null;
	
	if(document.getElementById) element=document.getElementById(aID);
	else if(document.layers) element=document.layers[aID];
	else if(document.all) element=document.all[aID];
	
	return element; 
}
function Highlight(p,c){
	$('#'+p).stop(true, true).animate({ backgroundColor: "#"+c }, 500);
}
function fchat_click(){
	var msg=$("#chat_msg").val();
	if(msg=="") return;
	if(typeof chat_offline!="undefined" && chat_offline==true){
		alert("El Chat no se encuentra disponible en este horario. Inténtelo de nuevo más tarde.");
		return;
	}
	$.colorbox({
		href:direccionorigen+"chat.php?msg="+msg,
		iframe:true,
		width:"530",
		height:"460",
		scrolling:false,
		overlayClose:false,
		escKey:false,
		onOpen:function(){ $('#swf_cabecera').hide(); },
		onClosed:function(){ $('#swf_cabecera').show(); }
	});
}
function fvideo_click(){
	$.colorbox({
		href:direccionorigen+"video.html",
		iframe:true,
		width:"705",
		height:"445",
		scrolling:false,
		overlayClose:false,
		escKey:true,
		onOpen:function(){ $('#swf_cabecera').hide(); },
		onClosed:function(){ $('#swf_cabecera').show(); }
	});
}
function fmarco_cambia(){
	marco_elemsp=0;
	for(i=0;i<marco_elems.length;i++){
		$.ajax({
			type: "POST",
			url: direccionorigen+"admin_ajax_operaciones.php",
			data: "op=dame_marco&idp="+marco_elems[i][0]+"&id="+marco_elems[i][1]+"&sig=1&clase="+(marco_elems[i][2]?marco_elems[i][2]:"")+(marco_elems[i][3]?"&aux="+marco_elems[i][3]:""),
			success: function(msg){
				if(msg!=""){
					aux=msg.split("[;]");
					for(var j=0;j<marco_elems.length;j++) if(marco_elems[j][0]==aux[0]){marco_elems[j][1]=aux[1];break;}
					$("#"+marco_elems[j][0]).html(aux[2]);
					replace_cufon();
				}
				marco_elemsp++;
				if(marco_elemsp>=marco_elems.length) setTimeout("fmarco_cambia()",marco_elemst);
			}
		});
	}
}
function fabre_tienda(){
	var form=$("form[name=ftienda]");
	window.location=form.attr('action')+'&id='+$("#tienda_id").val();
}
var tmenu_hoverv=false;
$(document).ready(function(){
	if(typeof colorbox!="undefined"){
		$("a[rel='thumb_image']").colorbox({
			onOpen:function(){ $('#swf_cabecera').hide(); },
			onClosed:function(){ $('#swf_cabecera').show(); }
		});
		$(".video_image").colorbox({
			onOpen:function(){ $('#swf_cabecera').hide(); },
			onClosed:function(){ $('#swf_cabecera').show(); },
			iframe:true,
			innerWidth:425,
			innerHeight:344
		});
	}
	$(".tmenu_submenu").hover(
		function () {
			tmenu_hoverv=true;
			var testObj=$(".tmenu_submenu1");
			testObj.slideDown("slow");
		}, 
		function () {
			tmenu_hoverv=false;
			var testObj=$(".tmenu_submenu1");
			setTimeout(function() {
				if(!tmenu_hoverv) testObj.slideUp("fast");
			}, 200);
		}
	);
	$(".tmenu_submenu1").hover(
		function () {
			tmenu_hoverv=true;
		}, 
		function () {
			tmenu_hoverv=false;
			var testObj=$(".tmenu_submenu1");
			setTimeout(function() {
				if(!tmenu_hoverv) testObj.slideUp("fast");
			}, 100);
		}
	);
});
function replace_cufon(){
	Cufon.replace('h6', {
		fontFamily:'Myriad_Pro',
		fontSize:'20px',
		color:'#FFFFFF',
		lineHeight:'20px',
		hover: {
			color:'#585858'
		}
	});
	Cufon.replace('h8', {
		fontFamily:'Myriad_Pro',
		fontSize:'26px',
		color:'#A7DD01',
		lineHeight:'26px'
	});
}
Cufon.replace('h5', {
	fontFamily:'Myriad_Pro',
	fontSize:'20px',
	color:'#A7DD01',
	lineHeight:'20px',
	hover: {
		color:'#585858'
	}
});
Cufon.replace('h7', {
	fontFamily:'Myriad_Pro',
	fontSize:'20px',
	color:'#00A4D9',
	lineHeight:'20px',
	hover: {
		color:'#585858'
	}
});
replace_cufon();
