
/* jsBasic: Provides a set of basic methods for javascript.
   no constructor parameters
*/
function jsBasic (){
/*
[public methods]
- log
- popup
- popupfull
- show
- hide
- setText
- setTrColor
*/
	
	// this property contains the log obj	
	this.logClass = null;
	
	// this property contains the popup window obj
	this.popupw = null;
	
	
	//- START log settings
	//*** method setLog : sets the internal log class
	function jsBasic_setLog(param_active, param_newwindow){
		this.logClass = new jsLOG(param_active, param_newwindow);
	}
	this.setLog = jsBasic_setLog;
	
	//*** method log : sends the text to the log
    function Page_log( param_str ) {
      this.logClass.log ( param_str );
    }
    this.log = Page_log;
	//- END log settings
	
	
	//*** method open popup window
	function jsBasic_popup(param_href, param_width, param_height, param_hasScroll) {
		if(param_hasScroll) {
			this.log('[popup method - executing popup method with scrollbars' );
			this.popupw = window.open(param_href,"","toolbar=0,directories=0,status=0,menubar=0,location=0,scrollbars=1,resizable=0,width="+param_width+",height="+param_height);
		} else {
			this.popupw = window.open(param_href,"","toolbar=0,directories=0,status=0,menubar=0,location=0,scrollbars=0,resizable=0,width="+param_width+",height="+param_height);
		}
	}
	this.popup = jsBasic_popup;
		
	//*** method open popup window with full features
	function jsBasic_popup(param_href, param_width, param_height) {
		this.popupw = window.open(param_href,"","toolbar=1,directories=1,status=1,menubar=1,location=1,scrollbars=1,resizable=1,width="+param_width+",height="+param_height);
	}	
	function jsBasic_popupfull(param_href, param_width, param_height) {
		this.popupw = window.open(param_href,"","toolbar=1,directories=1,status=1,menubar=1,location=1,scrollbars=1,resizable=1,width="+param_width+",height="+param_height);
	}
	
	this.popupfull = jsBasic_popupfull;
	

	
	//***method to show divs
	function jsBasic_show(param_obj){
	    if (document.getElementById && document.getElementById(param_obj) != null) {
			this.log('[show method - executing show method for object id: ' +  param_obj);
         	document.getElementById(param_obj).style.visibility='visible';
         	document.getElementById(param_obj).style.display='block';	
	    }
	}
	this.show = jsBasic_show;
	
	//***method to hide divs
	function jsBasic_hide(param_obj){
	    if (document.getElementById && document.getElementById(param_obj) != null) {
			this.log('[hide method - executing hide method for object id: ' +  param_obj);		
	         document.getElementById(param_obj).style.visibility='hidden';
	         document.getElementById(param_obj).style.display='none';
	    }	
	}
	this.hide = jsBasic_hide;
	
	
	//***method to set inner Text
	function jsBasic_setText(param_obj, param_text){
	    if (document.getElementById && document.getElementById(param_obj) != null) {
			this.log('[setText method - executing setText method for object id: ' +  param_obj);		
	         document.getElementById(param_obj).innerHTML = param_text;
	    }	
	}
	this.setText = jsBasic_setText;

	//***method to set Tr bgColor
	function jsBasic_setTrColor(param_selected_row_id, param_new_row_id, param_highlight_class, param_default_class){
	    if (document.getElementById && document.getElementById(param_new_row_id) != null) {
			this.log('[setTrColor method - executing setTrColor method for object id: ' +  param_new_row_id);		
			 //change selected row to default class/color before set the highlighted one
		 	 if (document.getElementById(param_selected_row_id) != null)
			 document.getElementById(param_selected_row_id).className = param_default_class;
    		 
			 document.getElementById(param_new_row_id).className = param_highlight_class;
	    }	
	}
	this.setTrColor = jsBasic_setTrColor;
	
//end jsBasic class	
}
function goToAnchor(param_name)
{
	location.hash = param_name;
	return false;
}
function showbutton(id, parent_id, ffocus){ if (document.getElementById) { document.getElementById(id).style.top = document.getElementById(parent_id).style.top; document.getElementById(id).style.left = document.getElementById(parent_id).style.left; } else if (document.all) { document.all[id].style.top = document.all[parent_id].style.top; document.all[id].style.left = document.all[parent_id].style.left; } show(id); }
function hidebutton(id){ hide(id);} 
function openDCR(categoryType, DCRname, sectionName, discriminatorNbr, nodeName){
	var TS_SERVER;
	var winOptions;
	var newWindow;
	var branchPath;
	var workareaName;
	var targetURL;

	TS_SERVER = 'http://mrmteam01/iw-cc/command/iw.ccpro.launch_edit_form';

	targetURL = TS_SERVER + '?vpath=' + DCRname
	                      + '&ffocus=' + nodeName 
	                      + '&section=' + sectionName 
	                      + '&replicantNumber=' + discriminatorNbr;

    winOptions = "scrollbars=yes,resizable=yes,toolbar=no,menubar=no,width=800,height=600";
	window.open(targetURL, "TeamSite_Templating", winOptions);
}
