function NavigateTo(pageURL,InFrame)
{
	document.location.href = "PageDefault.aspx?pageurl=" + pageURL + "&InFrame=" + InFrame;
}

function WOpen(fPath,wName, wWidth,WHeight)
{
	WOpen(fPath,wName, wWidth,WHeight,0);
}

function WOpen(fPath,wName, wWidth,WHeight,wscroll)
{
	window.open(fPath,wName,"top=100,left=100,width=" + wWidth + ",height=" + WHeight + ",scrollbars=" + wscroll);
}

function NavigateToPopupDefault(pQstr)
{
	document.location.href = "PopupPageDefault.aspx?" + pQstr;
}

function OpenSubscribe()
{
	window.open('NProductSubscribe.aspx','productsubscribe',CenterWinProps(480,520));
}
function doClick(buttonName,e)
{
//the purpose of this function is to allow the enter key to 
//point to the correct button to click.
    var key;

        if(window.event)
            key = window.event.keyCode;     //IE
        else
            key = e.which;     //firefox
    if (key == 13)
    {
   
        //Get the button the user wants to have clicked
        var btn = document.getElementById(buttonName);        
        if (btn != null)
        { //If we find the button click it
			if(document.Form1.WucHeader1_txtSearch.value != "")
				btn.click();
            event.keyCode = 0
        }
    }
}

function CenterWinProps(w,h) 
{ 
	var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+'resizable=0'
	return winprops; 	
} 

function CenterWinPropsResize(w,h) 
{ 
	var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',resizable=1'
	return winprops; 	
} 
function CenterWinPropsScroll(w,h) 
{ 
	var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',resizable=1,scrollbars=1'
	return winprops; 	
} 

function OpenAdditionalFile(pDoc,ObjType,AddDocType,LinkID,DisplayType)
{			
	if(AddDocType == 2)
	{
		window.open(pDoc,"Additional",CenterWinPropsResize(805,605));
	}
	else if(AddDocType == 1)
	{
		if(DisplayType.toLowerCase() == "video")
			window.open("ShowVideo.aspx?custom=false&oType=" + ObjType + "&linkid=" + LinkID,"Video",CenterWinProps(475,380));
		else
			window.open("ShowVideoLibrary.aspx?oType=" + ObjType + "&linkid=" + LinkID,"Video",CenterWinPropsResize(475,425));
	}
	else if(AddDocType == 3)
	{
		window.open("ShowImageGallery.aspx?oType=" + ObjType + "&linkid=" + LinkID ,"ImageGallery",CenterWinProps(695,645));
	}
}

function AddAccessory(pId,pTABIndex) {
    var Winopen = window.open("AddItemOfInterest.aspx?action=additionalacc&accid=" + pId + '&tabindex=' + pTABIndex, 'AddItemOfInterest', "top=150,left=150,width=405,height=405");
    Winopen.focus();
}

function OpenSubPage(pPage) {
    var newpage = pPage;

    newpage = newpage.replace('.html', '.aspx');

    while (newpage.indexOf("/") != -1) {
        newpage = newpage.replace('/', '-');
    }

    var url = 'rhino_custom_' + newpage;
    top.window.location.href = url ;
}

// Removes leading whitespaces
function LTrim(value) {

    var re = /\s*((\S+\s*)*)/;
    return value.replace(re, "$1");

}

// Removes ending whitespaces
function RTrim(value) {

    var re = /((\s*\S+)*)\s*/;
    return value.replace(re, "$1");

}

// Removes leading and ending whitespaces
function trim(value) {

    return LTrim(RTrim(value));

}
