﻿boxmove = true;

function stopstartbox() {
    boxmove = !boxmove;
}

function getPos(inputElement) {
    var coords = new Object();
    coords.x = 0;
    coords.y = 0;
    try {
        targetElement = inputElement;
        if (targetElement.x && targetElement.y) {
            coords.x = targetElement.x;
            coords.y = targetElement.y;
        } else {
            if (targetElement.offsetParent) {
                coords.x += targetElement.offsetLeft;
                coords.y += targetElement.offsetTop;
                while (targetElement = targetElement.offsetParent) {
                    coords.x += targetElement.offsetLeft;
                    coords.y += targetElement.offsetTop;
                }
            } else {
                //alert("Could not find any reference for coordinate positioning.");
            }
        }
        return coords;
    } catch (error) {
        //alert(error.msg);
        return coords;
    }
}
function updatebox(obj) {
    if (boxmove) {
        var div = document.getElementById(obj);
        //mouseX=evt.pageX?evt.pageX:evt.clientX;
        //mouseY=evt.pageY?evt.pageY:evt.clientY;
        toppos = getPos(div).y + div.offsetTop;
        leftpos = getPos(div).x;

        document.getElementById('divTip').style.left = leftpos;
        document.getElementById('divTip').style.top = toppos + 10;

    }
}

function showTipz(oEvent) {
    var oDiv = document.getElementById("divTip");
    oDiv.setAttribute("visible", "true");
    oDiv.setAttribute("style", "left: 200");
    oDiv.setAttribute("style", "top: 200");
    //oDiv.style.top = //oEvent.clientY + 5;
}

function hideTipz(oEvent) {
    var oDiv = document.getElementById("divTip");
    oDiv.style.visibility = "hidden";
}

function noBorder(id) {
    document.getElementById(id).style.border = "2px solid #000";
}
function setBorder(id) {
    document.getElementById(id).style.border = "2px solid #fff";
}
function showOriginal(path, id) {

    //preload image files
    var image_1 = new Image();
    image_1.src = path;

    oldW = image_1.width;
    oldH = image_1.height;

    document.getElementById("ctl00_MainHolder_originalPhoto").setAttribute("src", path);
    document.getElementById("ctl00_MainHolder_originalPhoto").setAttribute("width", oldW);
    document.getElementById("ctl00_MainHolder_originalPhoto").setAttribute("height", oldH);
    document.getElementById("ctl00_MainHolder_hiddenPhotoId").value = id;

    if (oldW >= 900) {
        newH = (828 * oldH) / oldW;
        newW = 828;

        document.getElementById("ctl00_MainHolder_originalPhoto").setAttribute("width", newW);
        document.getElementById("ctl00_MainHolder_originalPhoto").setAttribute("height", newH);
    }
}
function resize(area) {
    if (area == "") {
        path = document.getElementById("ctl00_MainHolder_originalPhoto").getAttribute("src");

        //preload image files
        var image_1 = new Image();
        image_1.src = path;

        oldW = image_1.width;
        oldH = image_1.height;


        document.getElementById("ctl00_MainHolder_originalPhoto").setAttribute("width", oldW);
        document.getElementById("ctl00_MainHolder_originalPhoto").setAttribute("height", oldH);

        if (oldW >= 900) {
            newH = (828 * oldH) / oldW;
            newW = 828;

            document.getElementById("ctl00_MainHolder_originalPhoto").setAttribute("width", newW);
            document.getElementById("ctl00_MainHolder_originalPhoto").setAttribute("height", newH);
        }
    }
    else {
        path = document.getElementById("ctl00_MainHolder_" + area).getAttribute("src");

        //preload image files
        var image_1 = new Image();
        image_1.src = path;

        oldW = image_1.width;
        oldH = image_1.height;


        document.getElementById("ctl00_MainHolder_" + area).setAttribute("width", oldW);
        document.getElementById("ctl00_MainHolder_" + area).setAttribute("height", oldH);

        if (oldW >= 900) {
            newH = (828 * oldH) / oldW;
            newW = 828;

            document.getElementById("ctl00_MainHolder_" + area).setAttribute("width", newW);
            document.getElementById("ctl00_MainHolder_" + area).setAttribute("height", newH);
        }
    }
    function resize2(area) {
        path = document.getElementById(area).getAttribute("src");

        //preload image files
        var image_1 = new Image();
        image_1.src = path;

        oldW = image_1.width;
        oldH = image_1.height;


        document.getElementById(area).setAttribute("width", oldW);
        document.getElementById(area).setAttribute("height", oldH);

        if (oldW >= 900) {
            newH = (828 * oldH) / oldW;
            newW = 828;

            document.getElementById(area).setAttribute("width", newW);
            document.getElementById(area).setAttribute("height", newH);
        }
    }    
    function resize_thumbnail() {
        path = document.getElementById("ctl00_MainHolder_thumbnail_preview").getAttribute("src");

        //preload image files
        var image_1 = new Image();
        image_1.src = path;

        oldW = image_1.width;
        oldH = image_1.height;


        document.getElementById("ctl00_MainHolder_thumbnail_preview").setAttribute("width", oldW);
        document.getElementById("ctl00_MainHolder_thumbnail_preview").setAttribute("height", oldH);

        if (oldW >= 900) {
            newH = (828 * oldH) / oldW;
            newW = 828;

            document.getElementById("ctl00_MainHolder_thumbnail_preview").setAttribute("width", newW);
            document.getElementById("ctl00_MainHolder_thumbnail_preview").setAttribute("height", newH);
        }
    }
}
///////////////////////// PopupReklam gosterimi
//<![CDATA[
//window.onLoad = trf1();
//document.body.onscroll= letsscroll();
Showdelay();
var pf1BannerTimerID;
function trf1() { popupReklamBannerTimerID = setTimeout("trf1Now()", 1000); }
function trf1Now() { document.getElementById('popupReklam').style.display = 'block'; popupReklamBannerTimerID = setTimeout("hidepf1BannerNow()", 15000); }
function hidepf1BannerNow() { document.getElementById('popupReklam').style.display = 'none'; }
function letsscroll() { document.getElementById('popupReklam').style.top = document.body.scrollTop + 200; }
function delay() {
    //document.all['showDelay'].style.display='block';
}
function Showdelay() { setTimeout(delay, 15000); }
//]]>
/////////////////////////
