﻿    function GetRadWindow()
	{
		var oWindow = null;
		if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
		else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)
		return oWindow;
	}
	
	function openRadWindow(CustomerID)
    {
    var oWnd = radopen(CustomerID, "RadWindow1" );
    }
	
	function OnClientClose(sender,args)
    {
    document.location.reload()
    }
    function OnClientShow(sender,args)
    {
    var oWnd = GetRadWindow();
    oWnd.SetWidth(500);
    oWnd.SetHeight(600);
    }
    function SizeToFit()
       {
        window.setTimeout(
            function()
            {
                var oWnd = GetRadWindow();
                oWnd.SetWidth(document.body.scrollWidth + 4);
                oWnd.SetHeight(document.body.scrollHeight + 70);
                
            }, 400);
       }
    function RadCloseRedir(url)
    {
    //top.location.href='' + url '';GetRadWindow().Close();
    }

// --------------------- BASIC SITE FUNCTIONS --------------------------

// POP UP WINDOW
function popUp(URL, WIDTH, HEIGHT, SCROLL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=" + SCROLL + ",location=0,statusbar=0,menubar=0,resizable=0,width=" + WIDTH + ",height=" + HEIGHT + ",left = 640,top = 325');");
}

// PRINT PAGE
function printpage() {
window.print();  
}

// CLEAR ELEMENT TEXT
function ClearElementText(text, elementId) {
if (document.getElementById(elementId).value == text)
  document.getElementById(elementId).value = "";
}

// RE-ENTER ELEMENT TEXT ON BLUR
function SetElementText(text, elementId) {
if (document.getElementById(elementId).value == "")
  document.getElementById(elementId).value = text;
}

//CHECKS FOR SEARCH VALUE FROM QUERYSTRING AND RELOADS THE SEARCH
function SearchCheck() 
{
    if (document.getElementById('ecmBasicKeywords') != null)
    {
        document.getElementById('ecmBasicKeywords').value = document.getElementById('ctl00_templateContent_hld').value;
        ClearTaxonomySearch();__LoadSearchResult(EkSearch.getArguements(),'control=__ecmsearchresult&amp;__ecmcurrentpage=1');
    }     
}