var noted = false;

function showVideo(StrUrl, strId)
{
	//alert("1 : " + getNoted());
	if (getNoted() == false)
	{
		setNoted(true);
		$.ajax({
			type: "POST",
			url: "anotavideo.asp",
			data: "idcamping="+strId+"&idlengua=<%= auxIdLengua %>" ,
			timeout: 45000,
			success: function(content){
						
				setNoted(true);
				//alert("2 : " + getNoted());
									
				var strHtml = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"620\" height=\"380\">";
				strHtml += "<param name=\"movie\" value=\"_include/flash/mediaplayer.swf\"><param name=\"quality\" value=\"high\">";
				strHtml += "<param name=\"menu\" value=\"false\">";
				strHtml += "<param name=\"bgcolor\" value=\"#FFFFFF\">";
				strHtml += "<param name=\"allowfullscreen\" value=\"true\">";
				strHtml += "<param name=\"allowscriptaccess\" value=\"always\">";
				strHtml += "<param name=\"flashvars\" value=\"file=" + StrUrl + "&amp;autostart=true&amp;width=620&amp;height=380\">";
				strHtml += "<embed src=\"_include/flash/mediaplayer.swf\" allowscriptaccess=\"always\" allowfullscreen=\"true\" flashvars=\"file=" + StrUrl + "&amp;autostart=true&amp;width=620&amp;height=380\" width=\"620\" height=\"380\">";
				strHtml += "</object>";
				
				$("#popupContact").css({'height' : '380px', 'width' : '620px'});
				$("#popupContact #contactArea").html(strHtml);
				
				centerPopup(strHtml);
				//load popup
				loadPopup();
			},
			error: function()
			{
				alert("Ha habido un error intentando enviar la pagina.\nIntetelo de nuevo pasados unos minutos");
			}
		});
	}
}

function showContact()
{
	$("#popupContact").css({'height' : '380px', 'width' : '420px'});
	$("#popupContact #contactArea").load("contact.asp?idlengua=1",function(strHtml){
		centerPopup(strHtml);
		//load popup
		loadPopup();
		
		$("form[name='frm_contact']").FormValidator({
			send_url:'_include/asp/contenido/ajax/contact.asp',
			alert_img: '_include/i/attention.png',
			abs_offset:-18
		});		
	});
	

}

function showInfo(cmp)
{
		
		$( "#dialog-modal-"+cmp ).dialog({
			modal: true
		});
}

$(document).ready(function(){
		$("form[name='frm_newsletter']").FormValidator({
			send_url:'_include/asp/contenido/ajax/newsletter.asp',
			alert_img: '_include/i/attention.png',
			abs_offset:-18
		});
		
		$("#showvideo").fancybox({
			'zoomSpeedIn'		:	500,
			'zoomSpeedOut'		:	500,
			'width': 660,
			'height': 400
		});		

		$("a[action=showpic]").fancybox();
		
		$("ul#logos > li > div").click(function(){
			var URL = $(this).find("a:first").attr("href");
			window.open(URL, '_blank');
			return false;
		});
		
		$("ul#logos > li > div > a").click(function(){
			var URL = $(this).attr("href");
			window.open(URL, '_blank');
			return false;
		});	
		
		$("#lnk_Contact").click(function(){
			showContact();
		});
	
		//alert($("#BannersAdServer"));
		noted = false;
		$("#col_diapo a").each( function(){
			if ($(this).attr("urlvideo") != "" && $(this).attr("urlvideo") != null)	
			{
				var strDiv = "<div style=\"position: relative; top: 25px; left: 111px !important; left: 55px;width:20px;\"><a id=\"videoshow\" href=\"javascript:void(0)\" video=\"" + $(this).attr("urlvideo") + "\" idc=\"" + $(this).attr("idc") + "\"><img style=\"border: 0;\" src=\"_include/i/video.png\" alt=\"Video\" /></a></div>";
				
				//alert($(this).attr("urlvideo") + "\n" + $(this).attr("idc"));
				
				strDiv = '<span class="videoshow" video=' + $(this).attr("urlvideo") + ' idc=' + $(this).attr("idc") + '></span>\n';
				//alert(strDiv)
				
				//$(this).parent().parent().find("td").get(0).innerHTML = strDiv + $(this).parent().parent().find("td").get(0).innerHTML;
				$(this).prepend(strDiv);
		
				var lnk = $($($(this).parent().parent().find("td").get(0)).find("a > span.videoshow"));
				//alert(lnk.length);
				
				$(lnk).click( function() {
					var sURL = $(this).attr("video");
					var iIdc = $(this).attr("idc");
					
					//alert(iIdc);
					
					showVideo(sURL,iIdc);
					return false;
				});
			}
		});	
});
