﻿// JScript File

    function redirect_login(redirectUrl)
    { 
        if( redirectUrl != '' )
        {
            window.parent.document.location.href = redirectUrl;
        }
    }


    function remove_thickbox(redirectUrl)
    {
        if( redirectUrl != '' )
        {
            window.parent.document.location.href = redirectUrl;
        }
        else 
        {
            try 
            {
                var topLocation = new String( top.location.href );
            }
            catch( ex ){}
            
            try 
            {
                var queryString = new String( top.location.search );
            }
            catch( ex ){}
            
            if( topLocation.indexOf(window.parent.document.location.href) != -1 && getParentTaxonomyID() != "" )
            {                    
                var taxonomyParam = "?__taxonomyid=" + getParentTaxonomyID();
                
                if( queryString.indexOf("?") != -1 )
                {
                    if( queryString.indexOf("__taxonomyid") == -1)
                    {
                        queryString = queryString.replace("?", taxonomyParam + "&");
                    }
                }
                else 
                {
                    queryString = taxonomyParam;
                }
            }
            
            //if( parent != null )
            //{
            //    parent.location.href = parent.location.pathname + queryString;
            //}
            //else
            {
                top.location.href = top.location.pathname + queryString;
            }
        }
    }
    
    function getParentTaxonomyID()
    {
        var taxonomyID = "";
        if( window.parent.document.getElementById('taxonomyselectedtree') != null )
        {
            taxonomyID = window.parent.document.getElementById('taxonomyselectedtree').value;
        }
        
        return taxonomyID;
    }
    function btnContinue_Click()
    {
       //return $ektron(this).parent().attr('href',this);
       return window.parent.document.location.href;
    }
    
    //Click function for register link to redirect the user to the appropriate page
    function lblRegister_Click()
    {
        $ektron("#registrationLink").attr('href','register.aspx').click();
    }
    
    function cl()
    {
        remove_thickbox('');
    }

