function RemoveScrollBars()
{
	if(document.body.scroll != null)
	{
		document.body.scroll = "auto";
		document.body.style.overflowX = "hidden"; // hidden | scroll | auto
		document.body.style.overflowY = "auto";
	}
	else // #### MG: It's a different Browser (NN)
	{
		document.body.attributes("-moz-scrollbars-horizontal") = "scroll";
		document.body.attributes("-moz-scrollbars-vertical") = "no";
	}
}

function OpenCustomPopUpApp(base, id, url, width, height, resizable, location, menubar, scrollbars, status, titlebar, toolbar, undesigned)
{
	var basePage = "PopupDesigned.aspx";
	var scrolling = scrollbars;
	
	if(undesigned == null)
	{
		undesigned = false;
		//scrollbars = false;
	}
	
	if(undesigned)
	{
		basePage = "PopupUndesigned.aspx";
		//scrollbars = true;
	}
	
	var path = base + basePage + "?id=" + id + "&url=" + escape(url) + "&height=" + height + "&undesigned=" + undesigned + "&scrollbars=" + scrolling;
	var options = "width=" + width + ", height=" + height + ", resizable=" + (resizable ? 1 : 0) + ", location=" + (location ? 1 : 0) + ", menubar=" + (menubar ? 1 : 0) + ", scrollbars=" + (scrollbars ? 1 : 0) + ", status=" + (status ? 1 : 0) + ", titlebar=" + (titlebar ? 1 : 0) + ", toolbar=" + (toolbar ? 1 : 0);
	var win = window.open(path, "PopUp", options);
	
	if(win != null)
	{
		win.focus();
	}
}

function JumpTo(obj)
{
	obj.scrollIntoView();
}

function JumpToControl(controlName)
{
	document.getElementById(controlName).scrollIntoView();
}

function IsTextValid(text, invalidValues)
{
    if(text != null && text.length > 0 && invalidValues != null)
    {
        for(var i = 0; i < invalidValues.length; i++)
        {
            if(text.toUpperCase().indexOf(invalidValues[i]) > -1)
            {
                //alert("TEXT: " + text + " I: " + invalidValues[i]);
                return false;
            }
        }
        
        return true;
    }
    else
    {
        return true;
    }
}

/*
function TextBoxSearch_KeyDown(sender, searchButtonClientID)
{
	if(event.keyCode == 13)
	{
		var button = document.getElementById(searchButtonClientID);
		
		if(button != null)
		{
			button.focus();
			button.click();
		}
		
		return false;
	}
}
*/
function pageLoad(sender,e)
{
    if($find('ModalPopupExtender1') != null)
    {
        $find('ModalPopupExtender1').add_shown(cpc);
        $find('ModalPopupExtender1').add_hidden(cpe);
    }
    
    if($find('ModalPopupExtender2') != null)
    {
        $find('ModalPopupExtender2').add_shown(cpc);
        $find('ModalPopupExtender2').add_hidden(cpe);
    }
   
}

function cpc(ev)
{
    setStyleDisplayToObject('none');
                      
}

function cpe(ev)
{
    setStyleDisplayToObject('block');                
}

function setStyleDisplayToObject(styleDisplay )
{
    var objectTags = document.getElementsByTagName("object");
    if(objectTags != null)
    {
        for (var i = 0; i < objectTags.length ; i++)
        {                 
           objectTags[i].style.display = styleDisplay;                                        
        }
    }
}
