/* Several functions needed all over the site Original by op351.com in http://op351.com/ ( except when other specified ) */ // ******************************* BROWSER DETECTION // var to detect if browser is IE, FF or OPERA // NOTA: Netscape foi descontinuado var ie = false; var ff = false; var op = false; if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { var ie = true; var whichBrowser = "Internet Explorer"; var version = new Number(RegExp.$1); var minVers = 6; } if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { var ff = true; var whichBrowser = "Firefox"; var version = new Number(RegExp.$1); var minVers = 2; } if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { var op = true; var whichBrowser = "Opera"; var version = new Number(RegExp.$1); var minVers = 8; } if (/Mozilla[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { // for playstation var agentID = navigator.userAgent.toLowerCase(); if (agentID.indexOf("playstation 3") != -1) { var ps = true; var whichBrowser = "Playstation"; var version = new Number(RegExp.$1); // usar a versão Mozilla var minVers = 4; // usar a versão Mozilla } } // var to define error pages var errBrw = "http:///errors/error.php?errid=brw"; // error page to be redirected if not correct version var errVer = "http:///errors/error.php?errid=ver"; // NS or OPERA alternative page to be redirected if not IE browser // logics if (!ie && !ff && !op && !ps) window.location.replace(errBrw); if ((ie || ff || op || ps) && version < minVers) window.location.replace(errVer); //window.alert("O seu Browser é o : "+whichBrowser+" v"+version); //window.alert("O seu Browser é do tipo : "+navigator.userAgent); // ******************************* FIRST VISITOR CHECKING /* Original by The JavaScript Source (http://javascript.internet.com) Upgrade by op351.com (http://op351.com) --- SCRIPT REMOVED TEMPORARILY --- // define default page var defaultPage = "http://op351.com/firstvisitor_pt.htm"; // default page in Portuguese // define several contents to popup var redirPage = new Array(); redirPage[0] = defaultPage; redirPage[1] = ""; redirPage[2] = ""; redirPage[3] = ""; var redirpagePos = 0; // define if page selection is fixed or random ( a number from 0 to max. href position number; for random use -1 ) var arrayLen = redirPage.length; // total number of available pages to be redirected to if (redirpagePos == -1) // randomize or fix which page var randPos = Math.round((arrayLen-1)*Math.random()); else var randPos = redirpagePos; var firstvisitPage = redirPage[randPos]; // which page to redirect to // type of pop-up window var windowprops = "width=510,height=365,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,screenX=60,left=60,screenY=30,top=30"; // cookie duration (nr of days while no popup exists after first visit) var expDays = 30; // cookie definition function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j)==arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i==0) break; } return null; } function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } var exp = new Date(); exp.setTime(exp.getTime() + (expDays*24*60*60*1000)); function amt() { var op351 = GetCookie('op351') if(op351 == null) { SetCookie('op351','1') return 1 } else { var newcount = parseInt(op351) + 1; DeleteCookie('op351') SetCookie('op351',newcount,exp) return op351 } } function getCookieVal(offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr==-1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } //function checkCount() { var op351 = GetCookie('op351'); if (op351==null) { op351=1; SetCookie('op351', op351, exp); // window.location.replace(firstvisitPage); window.open(firstvisitPage, 'advpopup', windowprops); } else { op351++; SetCookie('op351', op351, exp); } //} END OF REMOVE */ // ******************************* PULL-DOWN MENU TO SELECT OTHER PAGE AND GO THERE var mainDir; // directory where target files are located (type 0 if this is not needed) var thisform; // form on the page where this directing function is located (given by order number) function closeWin() { if (!document.layers) setTimeout('window.close()', 8000); } function goThere(formNr,directory) { var mainDir = directory; var thisform = document.forms[formNr]; if ((thisform.list.options[thisform.list.options.selectedIndex].value != "nolink") && (mainDir != 0)) document.location.href = mainDir + thisform.list.options[thisform.list.options.selectedIndex].value; else if ((thisform.list.options[thisform.list.options.selectedIndex].value != "nolink") && (mainDir == 0)) document.location.href = thisform.list.options[thisform.list.options.selectedIndex].value; closeWin(); } //******************************* CHECK FRAME OFF /* OFF var parentWin = ""; if (parent.frames.length==0 && window.location.protocol=="http:") { if (parentWin != "") window.location.replace(parentWin); else window.location.replace("http://op351.com"); } */ // ******************************* SET DEFAULT STATUS BAR TEXT defaultStatus = "op351.com, Serviços Internet * Porto - PORTUGAL"; /* ******************************* PRINT THIS PAGE if (window.print) var prinThis = '

Imprimir
esta
página
'; */ // ******************************* OPEN USEFUL WINDOWS var largura = screen.width; var altura = screen.height; var larguraDisp = screen.availWidth; var alturaDisp = screen.availHeight; function openUrl() { window.open('url','window_name','width='+larguraDisp+',height='+alturaDisp+',dependent=yes,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=yes,resizable=yes,left=0,top=0,screenX=0,screenY=0'); return false; } // ******************************* DEBUGGING /* window.alert(output); */