//Workplaceintegration

var isDesktop=false;
var isLeanWP=false;
var updateTasks=null;
var refToDesktop=null;
var updateTaskSet=false;
var adoptOKCode="";


if( (this == top && this.name != "ROOT" ) || 
    (this.parent.name == "application" && this.name != "launchpad")) 
      this.name = WP_DesktopFrame;

if(this.name == WP_DesktopFrame) isDesktop=true;
if(top.frameContainer) isLeanWP=true;

if(this.name == "menu" && isLeanWP) { top.frameContainer.menuRef=this; }

if(isDesktop) {
  var UpdateTask = {
    isLegal: false,
    OKCode: "",
    nextOK: "",
    FormName: "",
    FormRef: null,
    FrameName: "",
    FrameRef: null  }
  if(!document.all && isLeanWP) top.frameContainer.applicationHref=this.location.href;
}


function searchForDesktop(ref) {
  if(ref.name == WP_DesktopFrame) return ref;
  if(ref == top) return null;
  return searchForDesktop(ref.parent);
}


function validObject( ref ) {
   var lsState = typeof( ref );
   var retValue = (lsState != "null") && 
     (lsState != "unknown") && 
     (lsState != "undefined");
   return retValue;
}


function deleteUpdateTask() {
   var taskObjectRef = searchForDesktop(this).UpdateTask;
   taskObjectRef.isLegal=false;
}


function setUpdateTask(OkCode,FormName) {
  var taskObjectRef = searchForDesktop(this).UpdateTask;

  taskObjectRef.isLegal=true;
  taskObjectRef.OKCode=OkCode
  taskObjectRef.FormName=FormName;
  taskObjectRef.FormRef=eval("this.document."+FormName);
  taskObjectRef.FrameName=this.name;
  taskObjectRef.FrameRef=this;
  onunload=deleteUpdateTask;
}


function launchUpdateTask(nextOK, FormName){
  var taskObjectRef = searchForDesktop(this).UpdateTask;
  if(taskObjectRef.isLegal) {
    taskObjectRef.nextOK=nextOK;
    taskObjectRef.FormRef.elements[0].value=taskObjectRef.OKCode;
    taskObjectRef.FormRef.elements['nextOK'].value=nextOK;
    taskObjectRef.FormRef.submit();
  }
  else {
     this.document[FormName].elements[0].value=nextOK;  
     this.document[FormName].submit();
  }
}


function fillFormWP(FTarget, FormRef) {
	if(this.name == "ROOT") this.name=WP_DesktopFrame;	

	if(FormRef.target == WP_DesktopFrame || FTarget == WP_DesktopFrame) {
		if(FormRef.elements['~target']) FormRef.elements['~target'].value = "_top";
		if(FormRef.elements['~Target']) FormRef.elements['~Target'].value = "_top";
		if(FormRef.elements[1]) if(FormRef.elements[1].value == WP_DesktopFrame) FormRef.elements[1].value = "_top";
	}
}


function javaEnc(content) {
	var re =  new RegExp("&","g");  content = content.replace(re,"%26");
	re =  new RegExp(":","g"); 	content = content.replace(re,"%3A");
	re =  new RegExp(" ","g"); 	content = content.replace(re,"%20");
	re =  new RegExp("!","g"); 	content = content.replace(re,"%21");
	re =  new RegExp("/","g"); 	content = content.replace(re,"%2F");
	re =  new RegExp("=","g"); 	content = content.replace(re,"%3D");
	if(!document.all) { // msie RegExp bug
         re =  new RegExp("\+","g"); content = content.replace(re,"%2B");
 	  re =  new RegExp("\?","g"); content = content.replace(re,"%3F");
       }
	return content;
}


function waitForRenameTarget(FormName,target,encoding) { // necessary for Netscape only
  document[FormName].target=target;
  document[FormName].encoding=encoding;
}


function launchCatalog(FCode,FormName,SrcFrame,FTarget) {
// open an external window and load the external catalog in it
  var targetCpy = document[FormName].target;
  var encodingCpy = document[FormName].encoding;  
  document[FormName].encoding="application/x-www-form-urlencoded";
  SetOkCode(FCode,FormName,SrcFrame,FTarget,"");
  
  if(document.all) { 
    document[FormName].target=targetCpy;
    document[FormName].encoding=encodingCpy;
  }
  else setTimeout("waitForRenameTarget('"+FormName+"','"+targetCpy+"','"+encodingCpy+"')",1000);
}


function sendHelpURL(HelpURL){
// register the help URL an prepare it for displaying 
   if ( typeof(SAP_launchSimpleSAPDocumentation) != "function" ||  SAP_launchSimpleSAPDocumentation( HelpURL ) == null ){
     if(isLeanWP) top.frameContainer.setHelpURL(HelpURL);
   }
}


function SAP_TerminateInterface_isOk() {
	return true;
}


function SAP_TerminateInterface_terminate( exitUrl ) {
	SAPWF_getInterface( "SAP_ExternalWindowInterface" ).closeAll();
}


function launchExtWindow(url, name, features){
// open an external window
  if(isLeanWP) top.SAP_ExternalWindowInterface.open(url,name,features);
//  else SAPWF_getInterface( "SAP_ExternalWindowInterface" ).open( url, name, features );
  else window.open( url, name, features );
}


function loadUrlFromExt(URL) {
// launch the given URL in the application area of the main window
  if( validObject(window.opener.top.frameContainer) ) window.opener.LoadInMainWindow(URL);
  else window.opener.location.href=URL;
}


function addSubscripedSession(URL) {
// register session
  if(isLeanWP) top.subscripedSessions.add(URL);
}


function termSubscripedSessions() {
// terminate all registered sessions
  if(isLeanWP) top.subscripedSessions.terminateAll();
}

function restartTransaction() {
     var desktopLocation = searchForDesktop(this).location;
     if( confirm(restartMessage) ) desktopLocation.href= restartURL;
} 
<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>
