﻿var gsid = 0;

function showvp() {
    mywin1 = open('showvp.aspx?id=' + document.getElementById("blenddiv").title, '', 'resizable=no, width=520,height=520,menubar=no, titlebar=no, scrollbars=yes, toolbar=no, status=no, location=no, directories=no, top=200, left=200');
}
function opensendarticle(a,b) {
    mywin1 = open('sendarticle.aspx?cid=' + b + '&aid=' + a, '', 'resizable=no, width=520,height=520,menubar=no, titlebar=no, scrollbars=yes, toolbar=no, status=no, location=no, directories=no, top=200, left=200');
}
function opennewletter() {
    mywin1 = open('newsletter.aspx', '', 'resizable=no, width=520,height=520,menubar=no, titlebar=no, scrollbars=yes, toolbar=no, status=no, location=no, directories=no, top=200, left=200');
}
function showeather() {
    mywin1 = open('weather.aspx', '', 'resizable=no, width=520,height=520,menubar=no, titlebar=no, scrollbars=yes, toolbar=no, status=no, location=no, directories=no, top=200, left=200');
}
function Showvpics(path) {
    document.getElementById("vpicmainid").src = path;
}
function ShowFN(a) {
    mywin1 = open('ShowFlashNews.aspx?Id=' + a, '', 'resizable=no, width=520,height=520,menubar=no, titlebar=no, scrollbars=yes, toolbar=no, status=no, location=no, directories=no, top=200, left=200');
}
function CloseScroledBanner() {
    scrooledbanner.style.visibility = 'hidden';
}
function Search() {
    if (document.getElementById("Option1").selected == false) {
        mywin = open('http://www.google.com/search?q=' + document.getElementById("Text1").value + '', '', 'resizable=yes, width=600,height=600,menubar=yes, titlebar=yes, scrollbars=1, toolbar=yes, status=yes, location=yes, directories=yes, top=350, left=350');
    }
    else {
        document.location = "search.aspx?src=" + escape(document.getElementById("Text1").value);
    }
}
function openRequestSong() {
    mywin = open('SongRequest.aspx', '', 'resizable=no, width=320,height=280,menubar=no, titlebar=no, scrollbars=1, toolbar=no, status=no, location=no, directories=no, top=350, left=350');
}
function openNewWindow(a, b, c) {
    popupWin = window.open(a, '', 'resizable=no, width=600,height=200,menubar=no, titlebar=no, scrollbars=1, toolbar=no, status=no, location=no, directories=no, width=' + b + ', height=' + c + ', left=400, top=100');
}
function incbanner(b) {
    document.body.CallMyWebService.callService(wsResult, "incbanner", b);
    return;
}
function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(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 VoteToPrimesurvey(sid, ip) {
    initWebservices();
    if (readCookie("survey" + sid) != null) {
        //ShowPrimeSurveyResult(sid);
        alert('אין באפשרותך להצביע פעמיים');
        return;
    }
    gsid = sid;
    for (var i = 0; i < document.aspnetForm.survey.length; i++) {
        if (document.aspnetForm.survey[i].checked) {
            document.body.CallMyWebService.callService(wsResult1, "VoteToItem", sid, document.aspnetForm.survey[i].value, ip);
            createCookie("survey" + sid, "0", 365);
            return;
        }
    }
    alert("בחר אחת מאפשריות הסקר");
}
function ShowPrimeSurveyResult(sid) {
    mywin = open('surveyresults.aspx?sid=' + sid, '', 'resizable=no, width=520,height=520,menubar=no, titlebar=no, scrollbars=1, toolbar=no, status=no, location=no, directories=no, top=200, left=200');
}
function initWebservices() {
    document.body.useService("primsurvey.asmx?WSDL", "CallMyWebService");
}
function wsResult(result) {
    //primeTotlaResult.innerText=" סה''כ מצביעים: " + result.value;
}

function wsResult1(result) {
    if (result.value == 0) {
        document.body.CallMyWebService.callService(wsResult, "GetPrimSurveyVotes", gsid);
        ShowPrimeSurveyResult(gsid);
    }
    else {
        //ShowPrimeSurveyResult(gsid);
        alert('אין באפשרותך להצביע פעמיים');
    }
}
function openNewWindow(a, b, c) {
    popupWin = window.open(a, '', 'resizable=no, width=600,height=200,menubar=no, titlebar=no, scrollbars=1, toolbar=no, status=no, location=no, directories=no, width=' + b + ', height=' + c + ', left=400, top=400');
}
function positionit() {
    masterdivobj = document.getElementById("masterdiv")
    var window_width = ie && !window.opera ? iebody.clientWidth : window.innerWidth - 20
    window_height = ie && !window.opera ? iebody.clientHeight : window.innerHeight
    var dsocleft = ie ? iebody.scrollLeft : pageXOffset
    var masterdivwidth = masterdivobj.width
    masterdivheight = masterdivobj.height
    masterdivobj.style.left = (masterdivleft == "right") ? window_width - masterdivwidth - 20 : masterdivleft
    setInterval("repositionit()", 100)
}
function repositionit() {
    if (ie) {
        dsoctop = ie ? iebody.scrollTop : pageYOffset
        masterdivobj.style.top = (masterdivtop == "bottom") ? window_height - masterdivheight - 14 + dsoctop : parseInt(masterdivtop) + dsoctop
    }
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
function blendimage(divid, imageid, imagefile, millisec, yy, xx) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    //document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
    changeOpac(0, imageid);
    document.getElementById(imageid).src = imagefile;
    document.getElementById(imageid).alt = xx;
    document.getElementById(divid).title = yy;
    for (i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')", (timer * speed));
        timer++;
    }
}
function blendimage1(divid, imageid, imagefile, millisec, yy, xx) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    changeOpac(0, imageid);
    document.getElementById(imageid).src = imagefile;
    document.getElementById(imageid).alt = xx;
    document.getElementById(divid).title = yy;
    document.getElementById("blenda").href = imagefile;
    for (i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')", (timer * speed));
        timer++;
    }
}
////////////////////////////////////////////////////////////////////////////////////////////////////
function getElementLeft(Elem) {
    var elem;
    if (document.getElementById) {
        var elem = document.getElementById(Elem);
    } else if (document.all) {
        var elem = document.all[Elem];
    }
    xPos = elem.offsetLeft;
    tempEl = elem.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}
function getElementTop(Elem) {
    if (document.getElementById) {
        var elem = document.getElementById(Elem);
    } else if (document.all) {
        var elem = document.all[Elem];
    }
    yPos = elem.offsetTop;
    tempEl = elem.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}
function changepics(a, xx) {
    if (a == 0) {
        xx.style.backgroundImage = "url('imagess/maintoolbar/searchdropdownlist_over.png')";
    }
    else {
        xx.style.backgroundImage = "url('imagess/maintoolbar/searchdropdownlist.png')";
    }
}
function changepics2(a, xx) {
    if (a == 0) {
        xx.style.backgroundImage = "url('imagess/maintoolbar/searchdropdownlistsmall_over.png')";
    }
    else {
        xx.style.backgroundImage = "url('imagess/maintoolbar/searchdropdownlistsmall.png')";
    }
}
function opensendminisite(a, b) {
    mywin1 = open('../../sendminisite.aspx?kind=' + a + '&id=' + b, '', 'resizable=no, width=520,height=520,menubar=no, titlebar=no, scrollbars=yes, toolbar=no, status=no, location=no, directories=no, top=200, left=200');
    
}