
function GetQueryString(DocumentID, DocumentTopicID, ContentID) {

	//check for parent frame. If null then this page is not contained within a frame
	var QueryString = ""
	
    QueryString=GetQueryStringBase(DocumentID, DocumentTopicID, ContentID)
    
	if (QueryString !="") {
		//remove the beginning "&" and replace it with ?
		QueryString="?" + QueryString.substring(1,QueryString.length) 
	}	

	return QueryString;
}

function GetRedirectQueryString(DocumentID, DocumentTopicID, ContentID) {

	//check for parent frame. If null then this page is not contained within a frame
	var QueryString = ""
	
    QueryString=GetQueryStringBase(DocumentID, DocumentTopicID, ContentID)
    
	if (QueryString !="") {
		//remove the beginning "&" and replace it with ?
		QueryString="&" + QueryString.substring(1,QueryString.length) 
	}	

	return QueryString;
}

function GetQueryStringBase(DocumentID, DocumentTopicID, ContentID) {

	//check for parent frame. If null then this page is not contained within a frame
	var QueryString = ""
	
	//append query string parameters as needed
	if (DocumentID !=null && DocumentID!='') {
		QueryString=QueryString + "&DocumentID=" + DocumentID
	}
	
	if (DocumentTopicID !=null && DocumentTopicID!='') {
		QueryString=QueryString + "&DocumentTopicID=" + DocumentTopicID
	}
		
	if (ContentID !=null && ContentID!='') {
		QueryString=QueryString + "&ContentID=" + ContentID
	}
	return QueryString;
}

function HandleEnterKey(event, Button){
	if (event.keyCode == 13) {        

        //stop the event from recursing (script handles both ie and firefox)
        if (event.preventDefault && event.stopPropagation) {
           if (event.cancelable) event.preventDefault();
           event.stopPropagation();
        } else {
           event.returnValue = false;
           event.cancelBubble = true;
        } 
   
		Button.click();
	} 
}

//************************************************
// VALIDATION FUNCTIONS
//************************************************
function IsTrue(Item) {

	if (Item==true) return true;
	if (Item=='True') return true;
	if (Item == 'true') return true;
	if (Item > 0) return true;
	if (Item == -1) return true;

}

function VFD(Item) {

	if (Item==null) return false;
	if (Item=='') return false;
	
	return true;
}

function IsNull(Item) {

	return (VFD(Item))==false;
}

