 var abc = Math.random() + "";
 var num = abc.substring(2,abc.length);

// banners
ordval=Math.floor (Math.random()*1000000);
ord=Math.floor (Math.random()*1000000);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function GetDomain () {
var url = ""+window.location+"";
pcountry = "pe";
}
GetDomain();

function mm(url,pref) {
        options = "scrollbars=no,height=600 width=720";
        if (pref == null) pref = 0;
        newWindow = window.open("http://www.terra.com.pe/php/videos/mm_choice.html?video="+url+"&pref="+pref,'mmedia',options);
}

function audio(audiofile) {
	options = "scrollbars=no,height=200,width=285";
	newWindow = window.open("http://www.terra.com.pe/multimedia/audio/audio.html?audio="+audiofile,'audio',options);
}

function openTvPlayer(szQs) {
        var szUrl = new String("http://multimedia.terra.com/ot_frameset.asp");
        if (szQs != "") {
                szUrl += szQs;
        }
	window.open(szUrl, "entplayer","height=615,width=800,toolbar=0,directories=0, location=0,status=0,scrollbars=1,resize=1,menubar=0,copyhistory=1");
}

function SearchIt () {
        if (document.fast.query.value == 0) {
                alert("ERROR: Has olvidado rellenar el campo de bœsqueda, que no puede dejarse en blanco");
                return false;
        }
        if (document.fast.query.length < 3) {
                alert("ERROR: La palabra de bœsqueda debe tener m‡s de 3 caracteres");
                return false;
        }
	if (document.fast.multimedia.length == null) {
                document.fast.method = "get";
                document.fast.action = "http://buscador.terra.com/default.asp";
        } else {
                for (var i=0;i<document.fast.multimedia.length;i++) {
	                if (document.fast.multimedia[i].checked) {
	                        if (document.fast.multimedia[i].value == "image") {
	                                document.fast.action = "/cgi-bin/fast/legal.pl";
	                                document.fast.catalog.value = "image";
	                                document.fast.cgi.value="mm.pl";
	                        }
	                        if (document.fast.multimedia[i].value == "audio") {
	                                document.fast.action = "/cgi-bin/fast/legal.pl";
	                                document.fast.catalog.value = "audio";
	                                document.fast.cgi.value="mm.pl";
	                        }
	                        if (document.fast.multimedia[i].value == "video") {
	                                document.fast.action = "/cgi-bin/fast/legal.pl";
	                                document.fast.catalog.value = "video";
	                                document.fast.cgi.value="mm.pl";
	                        }
	                        if (document.fast.multimedia[i].value == "cancion")  {
	                                document.fast.action = "/cgi-bin/fast/legal.pl";
	                                document.fast.cgi.value="audio.pl";
	                        }
	                        if (document.fast.multimedia[i].value == "descargas")  {
	                                document.fast.action = "/cgi-bin/fast/ftp.pl";
	                        }
	                        if (document.fast.multimedia[i].value == "letra") {
	                                document.fast.action = "/cgi-bin/fast/legal.pl";
	                                document.fast.cgi.value = "lyrics.pl";
	                        }
	                        if (document.fast.multimedia[i].value == "multimedia") {
	                                document.fast.action = "/cgi-bin/fast/legal.pl";
	                                document.fast.catalog.value = "all";
	                                document.fast.cgi.value="mm.pl";
	                        }
	                        if (document.fast.multimedia[i].value == "internet") {
	                                document.fast.method = "get";
	                                document.fast.action = "http://buscador.terra.com/default.asp";
	                        }
	                        document.fast.submit();
                        }
                }
	}
}

function SearchIt2 () {
        if (document.MenuSearch.query.value == 0) {
                alert("ERROR: Has olvidado rellenar el campo de búsqueda, que no puede dejarse en blanco");
                return false;
        }
        if (document.MenuSearch.query.length < 3) {
                alert("ERROR: La palabra de búsqueda debe tener más de 3 caracteres");
                return false;
        }
                var i = document.MenuSearch.ca.selectedIndex;
                if (document.MenuSearch.ca.options[i].value == "x") {
                        document.MenuSearch.action = "javascript:pgSearchMenu();";
                } else {
                        document.MenuSearch.submit();
                        return true;
                }
}

function dealtimesearch () {
	 document.dealtime.action = "http://terra.dealtime.com/xKW-" + document.dealtime.searchparam.value + "/FD-0/nFormID-0/NS-1/keyword-sony/NS-1/linkin_id-3003647/GS.html?header=us";
        document.dealtime.submit();
}

function pgSearch () {
	document.pg.action = "http://terra.pricegrabber.com/search_gen_top.php/form_keyword=" + document.pg.keyword.value + "/mode=terra_channelsearch";
	document.pg.submit();
}



function mOvr(src,clrOver) {
  if (!src.contains(event.fromElement)) {
         src.style.background = clrOver;
        }
}
function mOut(src,clrIn) {
  if (!src.contains(event.toElement)) {
         src.style.background = clrIn;
        }
}




// tabs
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 MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function flipLayer (op) {

    if (op == '+') {

        if (layerNumber < layerMax) {
                layerNext = layerNumber + 1;
        } else {
                layerNext = 1;
        }

        MM_showHideLayers('fotonoticias'+layerNumber,'','hide','fotonoticias'+layerNext,'','show');
        layerNumber = layerNext;
    } else {

        if (layerNumber > 1) {
                layerPrior = layerNumber - 1;
        } else {
                layerPrior = layerMax;
        }

        MM_showHideLayers('fotonoticias'+layerNumber,'','hide','fotonoticias'+layerPrior,'','show');
        layerNumber = layerPrior;
    }
}

function abrir_img(im,ti,ex,ancho,alto){
	imagen=im;
	tituloi=ti;
	extrasi=ex;
	anchoi=ancho;
	altoi=alto;
	masAlto=alto+11;
	features = "width="+ancho+",height="+masAlto;
	window.open("/templates/includes/ver_imagen.htm",ancho+alto,features);
}

function wConcurso(filename) {
    mywindow = window.open(filename,"concurso","width=390,height=260,status=no,menubar=no,toolbar=no,scrollbars=no,resizable=no");
}

