var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function getAnchorPosition(anchorname)
{
    // This function will return an Object with x and y properties
    var useWindow=false;
    var coordinates=new Object();
    var x=0,y=0;
    // Browser capability sniffing
    var use_gebi=false, use_css=false, use_layers=false;
    if (document.getElementById) { use_gebi=true; }
    else if (document.all) { use_css=true; }
    else if (document.layers) { use_layers=true; }
    // Logic to find position
    if (use_gebi && document.all)
    {
        x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
        y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
    }
    else if (use_gebi)
    {
        var o=document.getElementById(anchorname);
        x=AnchorPosition_getPageOffsetLeft(o);
        y=AnchorPosition_getPageOffsetTop(o);
    }
    else if (use_css) 
    {
        x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
        y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
    }
    else if (use_layers) 
    {
        var found=0;
        for (var i=0; i<document.anchors.length; i++)
        {
            if (document.anchors[i].name==anchorname) { found=1; break; }
        }
        if (found==0) 
        {
            coordinates.x=0; coordinates.y=0; return coordinates;
        }
        x=document.anchors[i].x;
        y=document.anchors[i].y;
    }
    else 
    {
        coordinates.x=0; coordinates.y=0; return coordinates;
    }
    coordinates.x=x;
    coordinates.y=y;
    return coordinates;
}
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname)
{
    var coordinates=getAnchorPosition(anchorname);
    var x=0;
    var y=0;
    if (document.getElementById) 
    {
        if (isNaN(window.screenX)) 
        {
            x=coordinates.x-document.body.scrollLeft+window.screenLeft;
            y=coordinates.y-document.body.scrollTop+window.screenTop;
        }
        else 
        {
            x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
            y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
        }
    }
    else if (document.all) 
    {
        x=coordinates.x-document.body.scrollLeft+window.screenLeft;
        y=coordinates.y-document.body.scrollTop+window.screenTop;
    }
    else if (document.layers) 
    {
        x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
        y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
    }
    coordinates.x=x;
    coordinates.y=y;
    return coordinates;
}
// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el)
{
    var ol=el.offsetLeft;
    while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
    return ol;
}
function AnchorPosition_getWindowOffsetLeft (el) 
{
    return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
}	
function AnchorPosition_getPageOffsetTop (el) 
{
    var ot=el.offsetTop;
    while((el=el.offsetParent) != null) { ot += el.offsetTop; }
    return ot;
}
function AnchorPosition_getWindowOffsetTop (el) 
{
    return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
}
function LiveSupportShowDiv(obj,aname, qval)
{     
 
if(document.getElementById('vapsskyDiv').style.visibility == "hidden")
{//alert();

 var rand_no = Math.random();
rand_no = rand_no * 10000;
rand_no = Math.ceil(rand_no);
 qval = qval + "&r_no=" + rand_no;
    if(!document.getElementById("div_"+obj.id))
	{		
        ParentElement=document.getElementById("vapsskyDiv");
        //ParentElement.style.position='absolute';
        ParentElement.style.border=0;
        ParentElement.style.zindex=1; 
                
        var obj = document.createElement("object");
        var embed = document.createElement("embed");
        obj.setAttribute("classid", "clsid 27CDB6E-AE6D-11cf-96B8-444553540000");
        obj.setAttribute("codebase", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0");
        obj.setAttribute("width", "332");
        obj.setAttribute("height", "268");
        obj.setAttribute("border", "0");
                                
        obj.setAttribute("id", "MihopaMediaObject"); 
            
        embed.setAttribute("src", "http://www.vapssky.com/images/ChatClient1.swf?"+qval);
        embed.setAttribute("width", "332");
        embed.setAttribute("height", "268");
        embed.setAttribute("border", "0");
        embed.setAttribute("quality", "high");
        embed.setAttribute("pluginspage", "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash");    
        embed.setAttribute("type", "application/x-shockwave-flash");    
        embed.setAttribute("wmode", "transparent");    
        
        createElementParam('movie', 'http://www.vapssky.com/images/ChatClient1.swf?'+qval, obj);
        createElementParam('quality', 'high', obj);
        createElementParam('wmode', 'transparent', obj);
        createElementParam('allowScriptAccess', 'sameDomain', obj);       
        
        if (obj.outerHTML) 
        {           
            ParentElement.innerHTML = embed.outerHTML;            
        } 
        else 
        {           
            ParentElement.appendChild(obj);         
            ParentElement.appendChild(embed);
        }                
        
        browsername =  navigator.appName;
        var c = getAnchorPosition(aname);
         
        left =(c.x);
        toppx =(c.y);
        
        if( browsername == "Netscape")
        {
            left =(c.x);
            toppx = toppx-268;
            ParentElement.style.left = left+"px";
            ParentElement.style.top = toppx+"px";
        }
        else if( browsername == "Microsoft Internet Explorer")
        {        
            left =(c.x);
            toppx = toppx-167;
            ParentElement.style.left = left+"px";
            ParentElement.style.top = toppx+"px";
        }      
    }
    
    ParentElement.style.visibility = "visible";
    }
}
function LiveSupportHideDiv()
{     
   // document.getElementById('vapsskyDiv').style.visibility = "hidden";
}
function createElementParam(name, value, par)
{
    var elementParam = document.createElement("param");
    elementParam.setAttribute("name", name);
    elementParam.setAttribute("value", value);
    par.appendChild(elementParam);
}
