﻿function CreateBookmarkLink() {
    var title = "syrostoday.gr";
    var url = "http://www.syrostoday.gr";

    if (window.sidebar) {
        window.sidebar.addPanel(title, url, "");
    } else if (document.all) {
        window.external.AddFavorite(url, title);
    } else if (window.opera && window.print) {
        alert('Press ctrl+D to bookmark (Command+D for macs) after you click Ok');
    } else if (window.chrome) {
        alert('Press ctrl+D to bookmark (Command+D for macs) after you click Ok');
    }
}

function PopUp(url, id, width, height) {    
    if (navigator.userAgent.indexOf("Mac") > 0) {
        width = parseInt(width) + 15;
        height = parseInt(height) + 15;
    }
    var left = (screen.availWidth - width) / 2;
    var top = (screen.availHeight - height) / 2;

    window.open(url, id, 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',screenX=' + left + ',screenY=' + top + ',resizable=0');
}

function getClockTime() {
    var now = new Date();
    var hour = now.getHours();
    var minute = now.getMinutes();
    var second = now.getSeconds();
    var ap = "AM";
    if (hour > 11) { ap = "PM"; }
    if (hour > 12) { hour = hour - 12; }
    if (hour == 0) { hour = 12; }
    if (hour < 10) { hour = "0" + hour; }
    if (minute < 10) { minute = "0" + minute; }
    if (second < 10) { second = "0" + second; }
    var timeString = hour +
                    ':' +
                    minute +
                    ':' +
                    second +
                    " " +
                    ap;
    return timeString;
} 

function GetCookie(name) {
    var nameEq = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEq) == 0) return c.substring(nameEq.length, c.length);
    }
    return null;
}


function SetCookie(cookieName, cookieValue, days) {
    var expires;
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        expires = "; expires=" + date.toGMTString();
    }
    else {
        expires = "";
    }
    document.cookie = cookieName + "=" + escape(cookieValue) + expires;
}

function goToByScroll(id) {    
    $('html,body').animate({ scrollTop: $("#" + id).offset().top }, 'slow');    
}


function toggleMenu() {
    var divBu = document.getElementById("ulBU");      
    var arrBu = divBu.getElementsByTagName("li");
    for (var j = 0; j < arrBu.length; j++) {
        if (arrBu[j].style.display == "none")
            arrBu[j].style.display = "block";
    }
    document.getElementById("liMoreBU").style.display = "none"; 
    SetCookie("leftMenu", "visible");
}


function changeWeatherSize(id, valueHeight) {
    document.getElementById(id).style.height = valueHeight + 'px';
}

function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    if (query == '') {
        return '';
    }
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
            return pair[1];
        }
    }
    return '';
} 

function printContent(strid) {
    var prtContent = document.getElementById(strid);
    var winPrint = window.open('', '', 'left=0,top=0,width=650,toolbar=0,scrollbars=1,status=0,resizable=1');
    winPrint.document.write('<html>');
    winPrint.document.write('<head>');
    winPrint.document.write("<link rel=\"Stylesheet\" href=\"http://www.syrostoday.gr/styles/site.css\" type=\"text/css\" />");    
    winPrint.document.write('<title>' + document.title + '</title>');    
    winPrint.document.write('</head>');
    winPrint.document.write('<body ondragstart=\"return false;\" onselectstart=\"return false;\" onmousedown=\"return false;\">');
    winPrint.document.write('<div class=\"mainContent\" style=\"float: none !important; width: 100%; margin: 0px auto \">');
    winPrint.document.write("<div class=\"fullPage\" style=\"float: none !important; width: 100%; margin: 0px auto \">");
    winPrint.document.write("<div style=\"margin-top:20px;width: 100px; text-align:center;\"><img src=\"http://img.syrostoday.gr/site/syrostoday_logo_60.png\" /></div>");
    winPrint.document.write(prtContent.innerHTML);    
    winPrint.document.write("</div>");
    winPrint.document.write("</div>");    
    winPrint.document.write('</body>');
    winPrint.document.write('</html>');
    winPrint.document.close();
    winPrint.focus();
    winPrint.print();
}

function printAdContent(strid) {
    var prtContent = document.getElementById(strid);
    var winPrint = window.open('', '', 'left=0,top=0,width=660,toolbar=0,scrollbars=1,status=0,resizable=1');
    winPrint.document.write('<html>');
    winPrint.document.write('<head>');
    winPrint.document.write("<link rel=\"Stylesheet\" href=\"http://www.syrostoday.gr/styles/site.css\" type=\"text/css\" />");    
    winPrint.document.write('<title>' + document.title + '</title>');
    winPrint.document.write('</head>');
    winPrint.document.write('<body>');
    winPrint.document.write('<div class=\"mainContent\" style=\"float: none !important; width: 100%; margin: 0px auto \">');
    winPrint.document.write("<div class=\"fullPage\" style=\"float: none !important; width: 100%; margin: 0px auto \">");
    winPrint.document.write("<div style=\"margin-top:20px;width: 100px; text-align:center;\"><img src=\"http://img.syrostoday.gr/site/syrostoday_logo_60.png\" /></div>");
    winPrint.document.write(prtContent.innerHTML);    
    winPrint.document.write("</div>");
    winPrint.document.write("</div>");    
    winPrint.document.write('</body>');
    winPrint.document.write('</html>');
    winPrint.document.close();
    winPrint.focus();
    winPrint.print();
}





