/******************************************

     CopyRight 2005 Cell2solutions S.L.

*******************************************/
/*
ImageCounter = 0;
imgs = new Array("imgs/body/body_bottom.gif",
		"imgs/body/body_bottom_left.gif",
		"imgs/body/body_bottom_right.gif",
    		"imgs/body/body_deg.gif",
    		"imgs/body/body_left.gif",
    		"imgs/body/body_menu_deg.gif",
    		"imgs/body/body_right.gif",
    		"imgs/header/header_deg.gif",
    		"imgs/header/header_left.gif",
    		"imgs/header/header_right.gif",
    		"imgs/header/header_tab.gif",
    		"imgs/header/header_tab_end.gif",
    		"imgs/header/header_tab_selected.gif",
		"imgs/content/content_left.gif",
    		"imgs/content/content_right.gif",
    		"imgs/content/content_top.gif",
    		"imgs/content/content_top_left.gif",
    		"imgs/content/content_top_right.gif");



var TimerID=null;
function checker() {
		ImageCounter++;
		if (ImageCounter>=imgs.length-1) {
			Page = document.getElementById("PageBody");
			if (Page!=null) {
				
				Page.style.visibility='visible';
				Page.visibility='visible';
				clearInterval(TimerID);
			}
		}
}



for (i=0;i<imgs.length;i++) {
   	img =  new Image();
   	img.onload = checker;
   	img.src = imgs[i]; 	
}
TimerID = setInterval(checker,100);

*/

/* Muestra la pagina en el caso de que haya algun error en la carga de las imagenes */
function BodyOnLoad() {
		Page = document.getElementById("PageBody");
		if (Page!=null) Page.style.visibility='visible';
		//Page.visibility='visible';
		//clearInterval(TimerID);
}

function goSearch() {
		sinput = document.getElementById("search_input");
		keywords = sinput.value;
		document.location = "search.php?keywords="+keywords
}

function openWindow(murl,wname,w,h) {
		window.open(murl,wname,'width='+w+',height='+h+',toolbar=0,location=0,menubar=0,scrollbars=0,resizable=1');
}


function submitForm(name,parms) {
    form = document.getElementById(name);
    if (form==null) form = document.getElementsByName(name)[0];
    if (parms!=null) form.action=form.action + parms;
    form.submit();
}

function clearForm(name,parms){
alert("En construccion");
}


function openFlashWindow(producto, ancho, alto,params){
    var a="width="+ancho+","+"height="+alto;
    ventana = document.open(producto + "?" + params,"",a); 
}



function openFLV(ancho,alto,url) {
    var a="width="+ancho+","+"height="+alto;
    try {
    	curl = "php/flashplayer.php?url=" +url;
    	window.open(curl,"VideoPlayer",a);
    }
    catch (ex) {
    	alert(ex);
    }
}


function openPDF(ancho,alto,url) {
    var a;
    if (width) a ="width="+ancho;
    if (height) a = a +","+"height="+alto;
    
    try {
    	curl = "pdfviewer.php?url=" +url;
    	window.open(curl,"PDFViewer",a);
    }
    catch (ex) {
    	alert(ex);
    }
}

function notifyDownload(url,t) {
	ajax_call(null,"php/notifydownload.php?url=" + url + "&type=" + t,null);
}
