﻿<!--
function iPopup(link,width,height) {
		winstyle = "height=5,width=170,status=no,scrollbars=no,toolbar=no,menubar=no,location=no,resizable=1";	
		r=window.open("Base/Controls/IPopup.aspx?link=" + link + "&amp;width=" + width + "&amp;height=" + height, null, winstyle);
	}	

function PopupFlash(link, width, height, wmode, bgcolor, quality, menu,loop) {
        winstyle = "height=100,width=100,status=no,scrollbars=no,toolbar=no,menubar=no,location=no,resizable=1";	
        r=window.open("Base/Controls/PopupFlash.aspx?link=" + link + "&width=" + width + "&height=" + height + "&wmode=" + wmode + "&bgcolor=" + bgcolor + "&quality=" + quality + "&menu=" + menu + "&loop=" + loop, null, winstyle);
	}

function popup(ImgLnk) {
	    winstyle = "height=5,width=170,status=no,scrollbars=no,toolbar=no,menubar=no,location=no,resizable=1";	
	    r=window.open("Base/Controls/Popup.aspx?ImgLnk=" + ImgLnk, null, winstyle);
    }


function openWindow(theURL, winName, features) 
{ 
    window.open(theURL, winName, features);
}

function GetWidth()
{
        var x = 0;
        if (self.innerHeight)
        {
                x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                x = document.documentElement.clientWidth;
        }
        else if (document.body)
        {
                x = document.body.clientWidth;
        }
        return x;
}
 
function GetHeight()
{
        var y = 0;
        if (self.innerHeight)
        {
                y = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                y = document.documentElement.clientHeight;
        }
        else if (document.body)
        {
                y = document.body.clientHeight;
        }
        return y;
}

function openRadWin(url,width,height)
{
    var wnd = radopen(url,"RadWindow1"); 
    wnd.setSize(width,height);
    wnd.Center();
    if(GetHeight() < height)
    {
        wnd.moveTo(((GetWidth()-width)/2),20);
    }
    wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
}

function openRadWinWithBehaviors(url,width,height, behaviors, showStatusBar, locationReloadOnClientCloseEnabled)
{
    var wnd = radopen(url,"RadWindow1"); 
    wnd.setSize(width,height);
    wnd.Center();
    if(GetHeight() < height)
    {
        wnd.moveTo(((GetWidth()-width)/2),20);
    }

    if(locationReloadOnClientCloseEnabled)
    {
        wnd.add_close(OnClientClose)
    }
    else
    {
        wnd.add_close(OnClientCloseWithLocationReload)
    }

    wnd.set_behaviors(behaviors);
    wnd.set_visibleStatusbar(showStatusBar);
}
    
function openRadWinExtended(url,width,height,locationReloadOnClientCloseEnabled)
{
    var wnd = radopen(url,"RadWindow1"); 
    wnd.setSize(width,height);
    wnd.Center();
    if(GetHeight() < height)
    {
        wnd.moveTo(((GetWidth()-width)/2),20);
    }

    if(locationReloadOnClientCloseEnabled)
    {
        wnd.add_close(OnClientClose)
    }
    else
    {
        wnd.add_close(OnClientCloseWithLocationReload)
    }

    wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Maximize + Telerik.Web.UI.WindowBehaviors.Minimize);
    wnd.set_visibleStatusbar(false);
}           

function OnClientClose(wnd,eventArgs)
{
    location.reload();
    wnd.remove_close(OnClientClose);
}  

function OnClientCloseWithLocationReload(wnd,eventArgs)
{
    wnd.remove_close(OnClientClose);
} 

function SetProgressPosition(e, divToShow) {
    var posx = 0;
    var posy = 0;
    if (!e) var e = window.event;
    if (e.pageX || e.pageY) {
        posx = e.pageX;
        posy = e.pageY;
    }
    else if (e.clientX || e.clientY) {
        posx = e.clientX + document.documentElement.scrollLeft;
        posy = e.clientY + document.documentElement.scrollTop;
    }
    if (document.getElementById(divToShow) != null) {
        document.getElementById(divToShow).style.left = posx - 8 + "px";
        document.getElementById(divToShow).style.top = posy - 8 + "px";
    }
}
    
//Example
//var current_date = new Date;
//var cookie_year = current_date.getFullYear ( );
//var cookie_month = current_date.getMonth ( );
//var cookie_day = current_date.getDate ( ) +1;
//set_cookie ( 'username', 'NameOfUser', cookie_year, cookie_month, cookie_day );        
function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
    {
      var cookie_string = name + '=' + escape ( value );

      if ( exp_y )
      {
        var expires = new Date ( exp_y, exp_m, exp_d );
        cookie_string += '; expires=' + expires.toGMTString();
      }

      if ( path )
            cookie_string += '; path=' + escape ( path );

      if ( domain )
            cookie_string += '; domain=' + escape ( domain );
      
      if ( secure )
            cookie_string += '; secure';
      
      document.cookie = cookie_string;
    }

//Example
//delete_cookie('username');document.location.reload ( );
function delete_cookie ( cookie_name )
    {
      var cookie_date = new Date ( );  // current date & time
      cookie_date.setTime ( cookie_date.getTime() - 1 );
      document.cookie = cookie_name += '=; expires=' + cookie_date.toGMTString();
    }

//Example    
//var username = get_cookie ( "username" );    
function get_cookie ( cookie_name )
    {
      var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

      if ( results )
        return ( unescape ( results[2] ) );
      else
        return null;
    }


//-->
