﻿function OpenPopup()
{
   window.open('GetAlert.aspx','welcome','width=540,height=475,left=200,top=200');
}
function OpenWebcast()
{
   window.open('webcast.html','webcast','width=600,height=385,left=200,top=200');
}
function OpenJar()
{
    window.open('mobile/app.asp','welcome','width=375,height=175,left=200,top=200');
}
var int1,int2,int3,int4,int5,int6;
function move_up()
{
    document.getElementById("scroll_clipper").scrollTop += -15;
}
function move_down()
{
    document.getElementById("scroll_clipper").scrollTop += 15;
}
function mmove_up()
{
    clearintervals();
    int1=window.setInterval(move_up,200);
}
function mmove_down()
{
    clearintervals();
    int2=window.setInterval(move_down,200);
}
function clearintervals()
{
    clearInterval(int1);
    clearInterval(int2);
}
function move_up1()
{
    document.getElementById("Div8").scrollTop += -15;
}
function move_down1()
{
    document.getElementById("Div8").scrollTop += 15;
}
function mmove_up1()
{
    clearintervals1();
    int3=window.setInterval(move_up1,200);
}
function mmove_down1()
{
    clearintervals1();
    int4=window.setInterval(move_down1,200);
}
function clearintervals1()
{
    clearInterval(int3);
    clearInterval(int4);
}
function move_up2()
{
    document.getElementById("Div5").scrollTop += -15;
}
function move_down2()
{
    document.getElementById("Div5").scrollTop += 15;
}
function mmove_up2()
{
    clearintervals2();
    int5=window.setInterval(move_up2,200);
}
function mmove_down2()
{
    clearintervals2();
    int6=window.setInterval(move_down2,200);
}
function clearintervals2()
{
    clearInterval(int5);
    clearInterval(int6);
}
function drawmenu(arg)
{
    var pos=new Object();
    var source;
    var target;
    if(arg==1)
    {
        source=document.getElementById("source1");
        target=document.getElementById("dvInit");
        document.getElementById("div22").style.display="none";
        document.getElementById("div33").style.display="none";
        document.getElementById("div44").style.display="none";
    }
    if(arg==2)
    {
        source=document.getElementById("source2");
        target=document.getElementById("div22");
        document.getElementById("dvInit").style.display="none";
        document.getElementById("div33").style.display="none";
        document.getElementById("div44").style.display="none";
    }
    if(arg==3)
    {
        source=document.getElementById("source3");
        target=document.getElementById("div33");
        document.getElementById("dvInit").style.display="none";
        document.getElementById("div22").style.display="none";
        document.getElementById("div44").style.display="none";
    }
    if(arg==4)
    {
        source=document.getElementById("source4");
        target=document.getElementById("div44");
        document.getElementById("dvInit").style.display="none";
        document.getElementById("div22").style.display="none";
        document.getElementById("div33").style.display="none";
    }
    pos=GetAbsPosition(source);
    var displace=0;
    if(arg==1)
        displace=50;
    if(arg==2)
        displace=60;
    if(arg==3)
        displace=55;
    if(arg==4)
        displace=100;
	    
    target.style.left=pos.x+16-displace;
    target.style.top=pos.y+16;

    if(target.style.display=="block")
        target.style.display="none";
    else
        target.style.display="block";
}
function hidebothall()
{
    document.getElementById("dvInit").style.display="none";
    document.getElementById("div22").style.display="none";
    document.getElementById("div33").style.display="none";
    document.getElementById("div44").style.display="none";
}
function GetAbsPosition(object)
{
    var position = new Object;
    position.x = 0;
    position.y = 0;

    if( object )
    {
	    position.x = object.offsetLeft;
	    position.y = object.offsetTop;
    	
	    if( object.offsetParent )
	    {
		    var parentpos = GetAbsPosition(object.offsetParent);
		    position.x += parentpos.x;
		    position.y += parentpos.y;
	    }
    }
    position.cx = object.offsetWidth;
    position.cy = object.offsetHeight;
    return position;
}
function SetHome()
{
    if (window.external)
    {
        document.body.style.behavior='url(#default#homepage)';
        document.body.setHomePage('http://www.patrika.com');
    }
    else
    {
        alert("Due to security handling, your Browser is not allowing to Set Patrika as your homepage,you can manually copy http://www.patrika.com and set it as your Home page.");
    }
}
        

