﻿function submitajax(url) {

    ifrm = document.createElement("IFRAME");
    ifrm.id = "fam";
    ifrm.setAttribute("src", url);
    ifrm.style.width = 640 + "px";
    ifrm.style.height = 480 + "px";
    ifrm.style.visibility = "hidden";
    ifrm.className = "Hidden";
    document.body.appendChild(ifrm);

}

function PlaceObject(Object, Anchor, OffSetX, OffSetY) {
    var x = findPosX(document.getElementById(Anchor));
    var y = findPosY(document.getElementById(Anchor));
    var obj = document.getElementById(Object);

    
    obj.style.visibility = 'hidden';
    
    

    if (typeof window.innerWidth != 'undefined') {
        obj.style.top = y + OffSetY + 'px';
        obj.style.left = x + OffSetX + 'px';
    }
    else {
        obj.style.top = y + OffSetY;
        obj.style.left = x + OffSetX;
    }
    obj.style.visibility = '';
   
}

function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent)
        while (1) {
            curtop += obj.offsetTop;
            if (!obj.offsetParent)
                break;
            obj = obj.offsetParent;
        }
    else if (obj.y)
        curtop += obj.y;
    return curtop;
}

function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent)
        while (1) {
            curleft += obj.offsetLeft;
            if (!obj.offsetParent)
                break;
            obj = obj.offsetParent;
        }
    else if (obj.x)
        curleft += obj.x;
    return curleft;
}

function SetIFrameHeight(id) {
    //find the height of the internal page                          
    var the_height = document.getElementById(id).contentWindow.document.body.scrollHeight;
    document.getElementById(id).height = the_height + 20;
    var divTop = findPosY(document.getElementById(id));
    document.getElementById("divMainContent").style.height = (the_height + divTop) - 200;
}

function setCookie(c_name, value, expiredays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) +
        ((expiredays == null) ? "" : ";expires=" + exdate.toUTCString());
}

function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}
