
   function LaguageDDFunction(dropdownValue, fn_hidden_CMSChangeFlag_id, fn_DropDownList_PageLanguage_id)
   {
        var CMSChangeFlag_1 = false;
        CMSChangeFlag_1 = document.getElementById(fn_hidden_CMSChangeFlag_id);         

        if (CMSChangeFlag_1.value == 'true')
        {           
            if(confirm('Are you sure you want to navigate away from this page?\n\nPage will remain locked.\n\nPress OK to continue, or Cancel to stay on the current page.'))
            {
                CMSChangeFlag_1.value = false;                
                setTimeout('__doPostBack(\''+ fn_hidden_CMSChangeFlag_id +'\',\'\')', 0);
            }
            else
            {                            
                document.getElementById(fn_DropDownList_PageLanguage_id).value = dropdownValue; 
            }            
        }
        else
        {           
            setTimeout('__doPostBack(\''+ fn_hidden_CMSChangeFlag_id +'\',\'\')', 0);
        }      
   }   
                   
    
    function ConfirmRevertDraft(CMSChangeFlag)
    {
    
        if(confirm('Do you really want to revert to earlier draft version of the page?'))
        {            
            DisableWarning(CMSChangeFlag);
            return true;
        }
        else
        {
            return false;
        }
    }
    function DisableWarning(CMSChangeFlag)
    {
        document.getElementById(CMSChangeFlag).value=false;
        return true;
    }
    // To show ConfirmCancel dialog box
    function ConfirmRevertToLive(CMSChangeFlag)
    {
        if(confirm('Warning: Changes have been made to this page. If you revert to live, these changes will be discarded, whether made by you or by others. Continue?'))
        {            
            DisableWarning(CMSChangeFlag)
            return true;
        }
        else
        {
            return false;
        }
    }
    
    function GoTo(id)
    {
	    if(document.getElementById(id) != null)
	    {
		document.getElementById(id).focus();		
	    }
    }
        
        function findX(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 Timer(){
			this.obj = (arguments.length)?arguments[0]:window;
			return this;
		}
		
		Timer.prototype.setInterval = function(func, msec){
			var i = Timer.getNew();
			var t = Timer.buildCall(this.obj, i, arguments);
			Timer.set[i].timer = window.setInterval(t,msec);
			return i;
		}
		Timer.prototype.setTimeout = function(func, msec){
			var i = Timer.getNew();
			Timer.buildCall(this.obj, i, arguments);
			Timer.set[i].timer = window.setTimeout("Timer.callOnce("+i+");",msec);
			return i;
		}
		
		Timer.prototype.clearInterval = function(i){
			if(!Timer.set[i]) return;
			window.clearInterval(Timer.set[i].timer);
			Timer.set[i] = null;
		}
		Timer.prototype.clearTimeout = function(i){
			if(!Timer.set[i]) return;
			window.clearTimeout(Timer.set[i].timer);
			Timer.set[i] = null;
		}
		

		Timer.set = new Array();
		Timer.buildCall = function(obj, i, args){
			var t = "";
			Timer.set[i] = new Array();
			if(obj != window){
				Timer.set[i].obj = obj;
				t = "Timer.set["+i+"].obj.";
			}
			t += args[0]+"(";
			if(args.length > 2){
				Timer.set[i][0] = args[2];
				t += "Timer.set["+i+"][0]";
				for(var j=1; (j+2)<args.length; j++){
					Timer.set[i][j] = args[j+2];
					t += ", Timer.set["+i+"]["+j+"]";
			}}
			t += ");";
			Timer.set[i].call = t;
			return t;
		}
		Timer.callOnce = function(i){
			if(!Timer.set[i]) return;
			eval(Timer.set[i].call);
			Timer.set[i] = null;
		}
		Timer.getNew = function(){
			var i = 0;
			while(Timer.set[i]) i++;
			return i;
		}
		
        startList = function() 
			{
				menus = document.getElementById("nav").getElementsByTagName("LI");

				for (i=0; i<menus.length; i++) 
				{
					menus[i].onmouseover = function()
					{
					    //alert('menu');
						this.style.cursor = "pointer";
						
						//Start: menu to open up left or right
						winsize = document.body.offsetWidth;
						menusize = findX(this) + this.offsetWidth;
						if (((menusize + 150) >= winsize) && (this.offsetWidth > 150))
						{
						    this.className += " overleft";
						}
						else
						{
						    this.className += " over";
						}
		
						var pagename = window.location.pathname;
						var sPage = pagename.substring(pagename.lastIndexOf('/') + 1);                       

                        sPage = sPage.toLowerCase();				
                        
				}
					menus[i].onmouseout = function()
					{
						this.style.cursor = "default";
						
						//Start: menu to open up left or right
						this.timer = new Timer(this);
						this.timer.setTimeout("out",0);
						//End: menu to open up left or right
						
						var pagename = window.location.pathname;
						var sPage = pagename.substring(pagename.lastIndexOf('/') + 1);						

                        sPage = sPage.toLowerCase();	
                        
                        if (sPage == "leaderboard.aspx")
                        {
                            window.document.getElementById("ctl00_ContentPlaceHolder_DropDownList_Competition").style.display="block";                            
                        }
					}
					menus[i].out = function()
					{
					    this.className = this.className.replace("over", "");
					}
				}
			}
			
			window.onload = startList;
			
			//Added by Deepali Shah to resolve issue 8610.
			function SetFocus(ctrl)
			{
			    var o = document.getElementById(ctrl);
                if((o != undefined) && (o != null)) o.focus();
			}
			
			//Functions added by Dhawal
			function ShowPopUp(DivPopUpID, SignInStripID, divLoginID, textboxEmailID)
            {
                var DivPopUp = document.getElementById(DivPopUpID);
                if ( DivPopUp != null )
                {
                    //Following lines written by Dhawal for setting the position of the signin div 
                    var BrowserType = navigator.appName;
                    var BrowserVersion = parseInt(navigator.appVersion);
                    var SignInStrip = document.getElementById(SignInStripID);
                    var divLogin = document.getElementById(divLoginID);
                    divLogin.style.position = "absolute";
                    divLogin.style.top = findPosY(SignInStrip) + 0;
                    divLogin.style.left = findPosX(SignInStrip) - 21;
                    if (BrowserType == "Netscape")
                    {   
                        var divLogin_top = findPosY(SignInStrip) + 0;
                        divLogin.style.top = divLogin_top + '' + 'px';
                        var divLogin_left = findPosX(SignInStrip) - 21;
                        divLogin.style.left = divLogin_left + '' + 'px';
                    }         
                    //Above lines written by Dhawal for setting the position of the signin div      
                    DivPopUp.style.display = "block";
                    //For setting the focus on the email textbox
                    var textboxEmail = document.getElementById(textboxEmailID);
                    textboxEmail.focus();
                }
            }
            
            function HidePopUp( DivPopUpID)
            {
                var DivPopUp = document.getElementById(DivPopUpID);
                if ( DivPopUp != null )
                {
                    DivPopUp.style.display = "none";
                }
            }
      
            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 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;   
            }


