
/* **************************************************************************** */
/* File bbpscript.js                                                            */
/* contains JavaScript functions for B2B Procurement                            */
/* **************************************************************************** */


/* **************************************************************************** */
/* This function checks the browser version. It is mainly called by the Java Menu Applet 
	and the ESS TreeControl Applet via LiveConnect. */
/* **************************************************************************** */
function isBrowserVersionSufficient( checkObj ) {
	var ie 		= navigator.appName == "Microsoft Internet Explorer";
	var nn 		= navigator.appName == "Netscape";
	var mac	= (navigator.appVersion.indexOf( "Mac" ) != -1);
	var ver		= parseFloat( navigator.appVersion );
	var ver4	= (ver >= 4.0);
	
	if (checkObj == "CHECK_JDK1_1") 	return (ver >= 4.0) && (! mac) && (! nn || (ver >= 4.06) );
	if (checkObj == "CHECK_LAYERS") 	return (document.layers != null);
	if (checkObj == "CHECK_IE4") 		return (ie && ver4);
	if (checkObj == "CHECK_NN4") 		return (nn && ver4);

	return false; 
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* **************************************************************************** */
/*This function will finalize most of the Personal Information Services. The name of the form to submit will
	named in the template in the BHTML-parameter BBPForm. The okCode depends on the 
	application... */
/* **************************************************************************** */
function leavePage(FCode,ExitUrl,FormName)
{
	targetObject = eval('document.'+FormName);
	targetObject.elements[0].value = FCode;
	targetObject.elements[1].value = ExitUrl;
	targetObject.submit();
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* **************************************************************************** */
/* This function handles most of the button functionality in ESS. The <FORM>-Name will be set in 
	the templates (see above)... However, sometimes a form in a different frame
	will need to be sent. To do this, simply specify SrcFrame in the BHTML
	button constructor B2BButtonChFrame(OKCODE,BUTTON,SrcFrame). */
/* **************************************************************************** */
function SetOkCode(FCode,FormName,SrcFrame,FTarget, realTarget)
{
	if(FormName == '')
		FormName = "BBPForm";

	if (SrcFrame != '')
		FrameDesc = 'parent.' + SrcFrame + '.';
	else
		FrameDesc = '';
	
	targetObject = eval(FrameDesc +'document.'+ FormName);
	
	if (FTarget != '') {
        	targetObject.elements['~target'].value = FTarget;
	        targetObject.target = FTarget;
	}

	targetObject.elements.value = FCode;
	fillFormWP(FTarget, targetObject);
	if(realTarget) targetObject.target = realTarget;

	targetObject.submit();
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* **************************************************************************** */
/* This function also handles the ESS button logic, additionaly you can pass the target-Frame */
/* **************************************************************************** */
function TargetSetOkCode(FCode,FTarget,FormName)
{
    if(FormName == '') FormName = "BBPForm";
	targetObject = eval('document.'+FormName);
	targetObject.elements[0].value = FCode;
	targetObject.elements['~target'].value = FTarget;
	targetObject.target = FTarget; 
//*****
fillFormWP(FTarget, targetObject);
	targetObject.submit();
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* **************************************************************************** */
/* This function is needed for the changing of the pictures (open-/closed_folder.gif) in
	New Hire Event (pz15). Please refer to 'messageline.html' in ess_global. */
/* **************************************************************************** */
function hire(URL, HTML_INDEX1)
{
	top.frames.main.frames.MAIN_SCR.location = URL;
	top.frames.main.frames.MENU.switchPic(HTML_INDEX1);
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* **************************************************************************** */
/* This function submits the field values of the form in frame "CFITEMDET"  */
/* **************************************************************************** */
function sendForm()
{
	numOfFields = parent.CFITEMDET.document.forms[0].submit()
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */
  
/* **************************************************************************** */
/* This function manipulates and submits the form 'formname'  to start the F4 searchhelp.                          */
/* The searchhelp button is provided by the  BusinessHTML function 'F4HelpButton'                               */
/* with the same interface.                                                                                                                                         */
/* **************************************************************************** */
function setSearchHelp(formname, searchfield, description, select_description) {
    var form = document.forms[formname];
    if (form) {
      var form_action = form.action;
      if ( (form_action.indexOf("?") )  == -1) 
            form_action=form_action + "?";
      else 
            form_action=form_action + "&";
      form_action = form_action + "shelp_description=" + javaEnc(description) + "&shelp_select=" + javaEnc(select_description) +"&~searchhelp=" +  javaEnc(searchfield);
      form.action = form_action;
      form.submit();    
    }
  }  
/* ------------------------------------------------------------------------------------------------------------------------------------ */

 
/* ***************************************************************************************************************************************************************************************** */
/* ***************************************************************************************************************************************************************************************** */
/* ***************************************************************************************************************************************************************************************** */
/* Copied functions from version 1.0                                                  */
/* ***************************************************************************************************************************************************************************************** */


/* **************************************************************************** */
/* This is for the roadmap help frame on the left hand side within the launch pad */
/* **************************************************************************** */

var TOP		=  10;
var LEFT	=   5;
var TABLETOP= "<table width='150' height='80'><tr><td class='helpText' valign='top'>"
var TABLEBOT= "</td></tr></table>"

/* **************************************************************************** */
/* function openWindow(helpNum) */
/* **************************************************************************** */
function openWindow(helpNum) {
	window.open("help/help" + helpNum + ".html", "Help", "status=no,width=300,height=200,directories=no,location=no,toolbar=no,scrollbars=yes")
	return false;
	} // end function openWindow
	
/* ------------------------------------------------------------------------------------------------------------------------------------ */
/* **************************************************************************** */
/* function placeContent(theText,what) */
/* **************************************************************************** */
function placeContent(theText,what) {
	var place;

	if (document.all) {
		place = eval("document.all.helpLayer");
	   	place.innerHTML = theText;


		} // end if document.all (if IE)

	else if (document.layers) {
		var divL	= eval("document.helpLayer");	
		place = eval("document.helpLayer.document.layers['helpNN']");

	   place.document.open();
	   place.document.write(theText);
	   place.document.close();

		if (what == "close") {
			divL.clip.top		=   0;
			divL.clip.right	= 150;
			divL.clip.left		=   5;
			}

		}  // end if document.layers (if NN)
	} // end place

/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* **************************************************************************** */
/*function openLayer(helpNum,hrefRoll) */
/* **************************************************************************** */
// onmouseOver = openLayer(0,this)
function openLayer(helpNum,hrefRoll) {
	var helpText = eval("document.help_details.elements["+helpNum+"].value");

	var text = TABLETOP + helpText + TABLEBOT;
	placeContent(text,"open");

	//if (document.all) hrefRoll.style.color = "#C2AA8E";
	} // end function openLayer
/* ------------------------------------------------------------------------------------------------------------------------------------ */
/* **************************************************************************** */
/* function closeLayer(picture,hrefRoll) */
/* **************************************************************************** */
// onmouseOut = closeLayer(mimeURL thingy for personal picture,this)
//function closeLayer(picture,hrefRoll) {
	//placeContent("","close");
	//if (document.all) hrefRoll.style.color = "white";
	//} // end function closeLayer
	
/* ------------------------------------------------------------------------------------------------------------------------------------ */

	
/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* ***************************************************************************************************************************************************************************************** */
/* ***************************************************************************************************************************************************************************************** */
/* ***************************************************************************************************************************************************************************************** */
/* Functions concerning the inbox only*/
/* ***************************************************************************************************************************************************************************************** */
/* **************************************************************************** */
/* function BBP_InboxSetOkCode(FieldName,FieldValue,FCode,FormName,SrcFrame,FTarget,realTarget) */
/* **************************************************************************** */
function BBP_InboxSetOkCode(FieldName,FieldValue,FCode,FormName,SrcFrame,FTarget,realTarget){
var t_fn;
	if(FormName == '') FormName = "BBPForm";

   	if (SrcFrame != '') 	
		t_Object = eval('parent.' + SrcFrame + '.' + 'document.'+ FormName);
	else 
	        t_Object = eval('document.'+ FormName);

	if(FieldName != '')
        	t_fn = eval('t_Object[\'' + FieldName +'\']');

	if(t_fn) 
		t_fn.value = FieldValue;

	SetOkCode(FCode,FormName,SrcFrame,FTarget, realTarget)

}
/* **************************************************************************** */
/* function quit_n_jump(old_url,new_url) */
/* **************************************************************************** */
//for two active services, quits the first, jumps to the second
function quit_n_jump(old_url,new_url){
hiddenimg = new Image()
hiddenimg.src = old_url+'?~OkCode=/NEX'
call_set_url('top.location',new_url,500)
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */
/* **************************************************************************** */
/* function store_img(formname,radioname,url,inbox_url,no_input) */
//This function is collecting all the inputs from a given form
//and puts them into a string.
//Afterwards this string will be added to a given url as a query string.
//This url is then loaded in the background, and the current url is set to another given url.
//This has the effect of submitting a form, but jumping to a different url as given in the action
//of that form.
/* **************************************************************************** */
function store_img(formname,radioname,url,inbox_url,no_input){

q_string = new String();
var linesChecked;
if (radioname != 'BLANK'){
	pos = radioname.indexOf(";");
	if (pos > 0){
		string1 = radioname.substring(0,pos);
		string2 = radioname.substring(pos + 1, radioname.length);
		radiocount = string1.substring(string1.length - 1,string1.length - 2);
		string3 = string1.substring(0, string1.length - 3);
		for(var i = 0; i < radiocount; i++){
			lineradio = eval('document.'+formname+'[\"'+string3+'['+ (i+1) +']\"]');
			if (lineradio[0].checked == false && lineradio[1].checked == false){
				linesChecked = false;	
			}
		}//end for..
	if (linesChecked == false){
		alert(no_input);
		return;
		}
	}// end if pos>0
	else{
		radio_0 = eval('document.'+formname+'.'+radioname+'[0]');
		radio_1 = eval('document.'+formname+'.'+radioname+'[1]');
		formular = eval('document.'+formname);
	
		if ((radio_0.checked || radio_1.checked)){
			if(radio_0.checked){
				q_string = radioname + "=0";
			}
			else{
				q_string = radioname + "=1";	
			}
		}
		else{
			alert(no_input);
			return;
		}
	}//end else if pos>0
}//if (radioname != 'BLANK')


formular = eval('document.'+formname);
for(i=0;i<formular.length;i++)
	{
	if(formular.elements[i].name != radioname && formular.elements[i].value != '')
		{
		if(q_string !="")
			{
			q_string = q_string +'&'+ formular.elements[i].name + "=" + formular.elements[i].value;			
			}
		else
			{
			q_string = formular.elements[i].name + "=" + formular.elements[i].value;
			}
		}
	}
hiddenConfirm = new Image();
hiddenConfirm.src = url+"?"+q_string;
call_set_url('top.location',inbox_url+'&~dec_state=1&~confirm_url='+url,500)

}//function
/* ------------------------------------------------------------------------------------------------------------------------------------ */
/* **************************************************************************** */
/* function logoff(hiddenurl,win1,win2,url,line) */
//This one is called onLoad of template 200, to end the 2nd session
/* **************************************************************************** */
function logoff(hiddenurl,win1,win2,url,line){
if (win1 == win2)
	{
	if (line != 'BLANK')
		{
		document.location.href = url+'?~line='+line;
		}
	else
		{
		document.location.href = url;
		}
	}
else
	{
		hiddenImg= new Image();
   	hiddenImg.src=hiddenurl;
	if(top.FRAME_2.theForm && line != 'BLANKE')
		{	// we are back in the inbox
		call_set_url('top.FRAME_2.location',top.FRAME_2.theForm.refresh_url.value+'&~OKCode=DISP',500);
		}
	}
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* **************************************************************************** */
// these functions are made to refresh an additional frame
// for example at an onClick event from a link.
// 'what' means the location object which belongs to a certain frame,
// 'url' means the new url for that frame
// 'del' stans for the delay to load the url
// only the function 'call_set_url' is to be called
// example:
// OnClick="call_set_url('top.FRAME_3.location','/scripts/wgate/bbppu02/~flN0YXRlPTgzNjAuMDAzLjA2LjA0====?~framename=FRAME_3',500)"
/* **************************************************************************** */

/* **************************************************************************** */
/* function set_url(what,url) */
/* **************************************************************************** */
function set_url(what,url){	
page = eval(what);
page.href = url;
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */
/* **************************************************************************** */
/* function call_set_url(what,url,del) */
/* **************************************************************************** */
function call_set_url(what,url,del){
setTimeout('set_url(\''+what+'\',\''+url+'\')',del);
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* **************************************************************************** */
/* function SetOkCode2(FCode,TCode,FormName,FieldName,FieldValue) */
// submits forms from the HTML buttons
// onClick="SetOkCode('OK_code','target_name','form_name',FieldName,FieldValue)"
// This function is a copy of the function SetOkCode from below, it works in the 
// same way, but it has 2 parameters more: FieldName and FieldValue.
// With this additional parameters a hidden input field can be set
// dynamically. The hidden input field has to be in the form as 3rd element
// with void name and value: 
//1.    <input type="hidden" name="~OKCode" value="">
//2.    <input type="hidden" name="~Target" value="">
//3.    <input type="hidden" name="" value="">
/* **************************************************************************** */
function SetOkCode2(FCode,TCode,FormName,FieldName,FieldValue) {
	var whichform;

	if (FormName != "THREEFORMS" && FormName != "") {
		whichForm = eval("document." + FormName);

		whichForm.elements[0].value = FCode;
		whichForm.elements[2].name = FieldName;
		whichForm.elements[2].value = FieldValue;

		//if it is multi frame APP, the target gets set.
		if (TCode != "BLANK" ) {
			whichForm.elements[1].value = TCode;
		    whichForm.target = TCode ;
			}
//*****
fillFormWP(TCode, whichForm);
		whichForm.submit();
		} // end if just submitting one form

	// TCode must be BLANK!
	// forms must submit to their own frame
	// targets should be in forms on the individual pages
   	else if (FormName == "THREEFORMS") {
	        	for (var x=2; x<5; x++) {
	     		whichForm = eval("top.FRAME_" + x + ".document.theForm");
	    		whichForm.submit();
		    	} // end for
		whichForm = eval("top.FRAME_1.document.theForm");
		whichForm.elements[0].value = FCode;
		whichForm.elements[2].name = FieldName;
		whichForm.elements[2].value = FieldValue;
		whichForm.submit();
		} // end if submitting multiple forms
	else {
		alert("no frame name was specified")
		} // end else. if framename was blank

	};
/* **************************************************************************** */
/* splits a string by given delimiters, returns an array of strings             */
/* works with navigator 3.0 and internet explorer 3.0                           */
/* **************************************************************************** */
function SAP_split(string,delimiter){
	var a1 = new Array();
	var a2 = new Array();
	string1 = new String();
	string2 = new String();

	pos = string.indexOf(delimiter);
	string1 = string.substring(0,pos);
	string2 = string.substring(pos+delimiter.length);
	a1[0] = string1;

	if(pos >= 0){
		a2 = SAP_split(string2,delimiter);
	}else{
		a1[0] = string;
	}
	if(a2.length > 0){
		for(i=0;i<a2.length;i++){
			a1[i+1] = a2[i];
		}
	}
	return a1;
}

/* **************************************************************************** */
/* joins a stringarray with given delimiter(optional), returns one string       */
/* works with navigator 3.0 and internet explorer 3.0                           */
/* **************************************************************************** */
function SAP_join(StringArray,delimiter){
	TheString = new String();
	if(StringArray.length > 0){
		for(i=0;i<StringArray.length;i++)
		if(i == 0)
			TheString = StringArray[i];
		else
			TheString = TheString + delimiter + StringArray[i];
	}
	return TheString;
}

/* **************************************************************************** */
/* converts delimiters in a string, returns one string                          */
/* works with navigator 3.0 and internet explorer 3.0                           */
/* **************************************************************************** */
function SAP_replace(OldString,fromchar,tochar){
	NewString = new String();
	StringArray = new Array();
	StringArray = SAP_split(OldString,fromchar);
	NewString = SAP_join(StringArray,tochar);
	return NewString; 
}

/* **************************************************************************** */
/*quits a service, when another service is active                             */
/* works with navigator 3.0 and internet explorer 3.0                           */
/* **************************************************************************** */
function SAP_quit_service_background(url){
hidden = new Image();
if(url != "")
hidden.src = url + '?~OkCode=/NEX';
}
/* ------------------------------------------------------------------------------------------------------------------------------------ */
//End functions concerning the inbox



<script type="text/javascript"><!--
google_ad_client = "pub-8218604682990090";
/* 468x60, ´´½¨سع 10-7-15 */
google_ad_slot = "8788784950";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
