// JavaScript Document
var initialValues=new Array();
function populateInitialValues(myFormName)  {
 myPageForm=document.forms[myFormName];
 for (var i = 0; i < myPageForm.length; i++) {
   if (myPageForm.elements[i].type == 'checkbox' || myPageForm.elements[i].type == 'radio' ) {
     initialValues[i] = myPageForm.elements[i].checked;
   } else {
     initialValues[i] = myPageForm.elements[i].value;
   } 
 }
}
function checkForChanges(myFormName) {
 var dataChanged=false;
 myPageForm=document.forms[myFormName];
 for (var i = 0; i < myPageForm.length; i++) {
   if (myPageForm.elements[i].type == 'checkbox' || myPageForm.elements[i].type == 'radio' ) {
     if (myPageForm.elements[i].checked!=initialValues[i]) {
      dataChanged=true;
       break
     }
   } else {
     if (myPageForm.elements[i].value!=initialValues[i]) {
       dataChanged=true;
       break
     }
   } 
 }
 return dataChanged;
}

function getInitialTextFieldValue(myFieldName,jsFunction) {
    try {
    myPageForm=document.forms[0];
    for (var i = 0; i < myPageForm.length; i++) {
      if (myPageForm.elements[i].type == 'text') {
         if (myPageForm.elements[i].name==myFieldName) {
             myPageForm.elements[i].value = initialValues[i]; //Change the text box
             setColorBoxBgColor(myFieldName); //Change the color box
             if (jsFunction!="") {
                 eval(jsFunction); //Load any functions that is passed
             }
             break;
         }
      } 
    }
    } catch(e) {
    //alert('Error Inside getInitialTextFieldValue');
    }
}

function PromptSaveMsg(url,forwardname,myFormName,myElementName) {
 myPageForm=document.forms[myFormName];
 var isDataChanged = checkForChanges(myFormName);
 if (isDataChanged) {
  JSFunArrayString="saveAndProceed('"+forwardname+"','"+myFormName+"');but_yes.gif;doNotSaveAndProceed('"+url+"');but_no.gif;closeDialogMsg(dialogMsgBox);but_cancel.gif";
  AlertMsg(JSFunArrayString,myTabChangeMsg);
 } else {
   doNotSaveAndProceed(url);
 }
}
function saveAndProceed(forwardname,myFormName) {
   //call saving part
   closeDialogMsg(dialogMsgBox);   
   toggleProgressMsg(myPleaseWaitMsg,mySavingDataMsg);
   myPageForm=document.forms[myFormName];
   myPageForm.action=myPageForm.action+"&forwardname="+forwardname;
   myPageForm.submit();
}
function doNotSaveAndProceed(url) {
   document.location=url;
   //window.open (url, '_self');
}
function AlertMsg(JSFunArrayString,msgText) {
try {
document.getElementById("dialogMsgText").innerHTML=msgText;
var dialogActionButtons ='';
myArrayOfJSFuns = JSFunArrayString.split(";");
for (i = 0; i < myArrayOfJSFuns.length; i=i+2) {
 dialogActionButtons +='<a href="javascript:'+myArrayOfJSFuns[i]+';"><img src="../../admin/images/'+myArrayOfJSFuns[i+1]+'" border="0" alt="" hspace="3"></a>';
}   
 document.getElementById("dialogMsgActionButtons").innerHTML=dialogActionButtons;
 myLeft=(document.body.offsetWidth-400-20)/2;
 myTop=(document.body.scrollTop+200)
 //myTop=((document.body.offsetHeight)/2)-50;
 document.getElementById("dialogMsgBox").style.left=myLeft;
 document.getElementById("dialogMsgBox").style.top=myTop;

 var isIEBrowser = document.all?true:false;
 if (isIEBrowser) {
  //Hide any select elements that is on the same area as the msg box. Note the hiding routine is taken from jsCookMenu.js
  var msgDisplayObj = cmGetObject ("dialogMsgBox");
  msgDisplayObj.cmOverlap = new Array ();
  cmHideControl ("SELECT", msgDisplayObj);
 }
 
 document.getElementById("dialogMsgBox").style.visibility="visible";
} catch(e) {
return;}
}

function closeDialogMsg(id) {
 var msgDisplayObj = cmGetObject ("dialogMsgBox");
 cmShowControl (msgDisplayObj);
 id.style.visibility="hidden";
 testhide();
}

//This function was added to fix the issue of non showing select tags
function testhide(){
	for (i = 0; i < document.getElementsByTagName("select").length; ++i){
		if (document.getElementsByTagName("select")[i].style.visibility=="hidden"){
			document.getElementsByTagName("select")[i].style.visibility="visible";
		}
	}
}
//width_per - when the width as a percentage value is passed, it will use this to decide the left position. else will use the default
//height_per - when the height as a percentage value is passed, it will use this to decide the top position. else will use the default
function toggleProgressMsg(msgtitle,msg,width_per,height_per) {

    try {
    if (width_per!='' && width_per!=undefined) {
        myLeft=((document.body.offsetWidth*parseInt(width_per)/100)-400-20)/2;
    } else {
        myLeft=(document.body.offsetWidth-400-20)/2;
    }
    if (height_per!='' && height_per!=undefined) {
        myTop=((document.body.offsetHeight*parseInt(height_per)/100)/2)-50;
    } else {
        myTop=(document.body.scrollTop+200);
    }
    

    var obj = document.getElementById ("ProgressMsg");
    obj.style.left=myLeft;
    obj.style.top=myTop;
    
    try {
    var isIEBrowser = document.all?true:false;
   
    if (isIEBrowser) {
     //Hide any select elements that is on the same area as the msg box. Note the hiding routine is taken from jsCookMenu.js
     var msgDisplayObj = cmGetObject ("ProgressMsg");
     msgDisplayObj.cmOverlap = new Array ();
     cmHideControl ("SELECT", msgDisplayObj);
    }
	 } catch(e) {}
    obj.style.visibility="visible";
    //progressMsgTextId.innerText=msg;
    //ProgressMsg_msgBoxTitle.innerText=msgtitle;
    document.getElementById ("progressMsgTextId").innerHTML=msg;
    document.getElementById ("ProgressMsg_msgBoxTitle").innerHTML=msgtitle;
    bar1.showBar();
    } catch(e) {alert(e);}
 }


function hideProgressMsg() {
   var obj = document.getElementById ("ProgressMsg");
   obj.style.visibility="hidden";
   bar1.hideBar();
}

function openNewWindowToViewFile(fileLink) {
    window.open(fileLink);
}

function openDialog(fileLink,msg){
    JSFunArrayString="openNewWindowToViewFile('"+fileLink+"');but_yes.gif;closeDialogMsg(dialogMsgBox);but_no.gif";
    AlertMsg(JSFunArrayString,msg);
} 
function setFixedElements(){
 //DocScrollTop=document.body.scrollTop;
 DocScrollTop= document.getElementById("scrollArea").scrollTop;
 try {
  menuHeader.style.zIndex="200";
  topControlBar.style.zIndex="150";
  ArrayOfFixedIds = StringofHeaderRowFixedIds.split(",");
  for (i = 0; i < ArrayOfFixedIds.length; ++i) {
   document.getElementById(ArrayOfFixedIds[i]).style.position="relative";
   document.getElementById(ArrayOfFixedIds[i]).style.top=DocScrollTop;
  }

 } catch(e) {}
}

var prevRowClassName="";
var prevRowNo="";
var clickedRowNo="";
var clickedRowClassName="";

function changeRowBGColor(mRowNo,mNoofRows,mouseaction,bgcolorClass) {

 //To reset the bg color for the previously mouseover or clicked item
 if (prevRowClassName!="") {
  for (i = 1; i < mNoofRows+1; ++i) {
   myRowNo="RowNo_"+prevRowNo+"_"+i;
   document.all[myRowNo].className=prevRowClassName;
  }
 }
 //To reset the bg color for a clicked row
 if (clickedRowClassName!="") {
  for (i = 1; i < mNoofRows+1; ++i) {
   myRowNo="RowNo_"+clickedRowNo+"_"+i;
   document.all[myRowNo].className=prevRowClassName;
  }
  clickedRowClassName="";
  clickedRowNo="";
 }
 //Save the rowno and classname for a clicked item
 if (mouseaction=='click') {
  clickedRowNo=mRowNo;
  clickedRowClassName=document.all[myRowNo].className;
 }
 //Save the rowno and classname of a mouseover item
 prevRowNo=mRowNo;
 myRowNo="RowNo_"+mRowNo+"_1";
 prevRowClassName=document.all[myRowNo].className;

 if (bgcolorClass==undefined) {
  bgcolorClass='reportRowBgHighlight';
 } 
 
 //Change the bgcolor of a item when the mouse is over
 for (i = 1; i < mNoofRows+1; ++i) {
  myRowNo="RowNo_"+mRowNo+"_"+i;
  document.all[myRowNo].className=bgcolorClass;
 }
}
function resetRowBGColor(mRowNo,mNoofRows,mouseaction) {
 if (prevRowClassName!="" && clickedRowNo=='') {
  for (i = 1; i < mNoofRows+1; ++i) {
   myRowNo="RowNo_"+prevRowNo+"_"+i;
   document.all[myRowNo].className=prevRowClassName;
  }
 }
}


function showReportSearchParams(id) {
 paramsHidden=false;
 document.getElementById('MsgicoIMG').style.visibility="hidden";
 document.getElementById('RptSearchIcoIMG').style.visibility="hidden";
 document.getElementById('RptSearchIcoIMG').style.width="0px";
 document.getElementById(id).style.display="block";
}

function hideReportSearchParams(id) {
paramsHidden=true;
 document.getElementById('MsgicoIMG').style.visibility="visible";
 document.getElementById('RptSearchIcoIMG').style.visibility="visible";
 document.getElementById('RptSearchIcoIMG').style.width="170px";
 document.getElementById(id).style.display="none";
}

/*function showReportSearchParams(id) {
 pos= document.getElementById("scrollArea").scrollTop;
 document.getElementById(id).style.top=pos;
 document.all["RptSearchIcoIMG"].style.visibility="hidden";
 document.getElementById('showParamsButton').style.visibility="hidden";
 document.getElementById('showParamsButton').style.width="0px";
 document.all[id].style.display = "block";
}
function hideReportSearchParams(id) {
 document.all["RptSearchIcoIMG"].style.visibility="visible";
 document.getElementById('showParamsButton').style.visibility="visible";
 document.getElementById('showParamsButton').style.width="171px";
 document.all[id].style.display = "none";
}*/
function hideAllSearchParam(procount) {
//alert(procount)
 //ArrayOfIds = StringofIds.split(",");
 for (i = 0; i < 10; ++i) {
  document.getElementById("progdetailsrow"+i).style.display = "none";
 }
}

function hideSearchParam(StringofIds) {
ArrayOfIds = StringofIds.split(",");
 for (i = 0; i < ArrayOfIds.length; i++) {
  try{
   document.getElementById(ArrayOfIds[i]).style.display = "none";
   }catch(e){
   //document.getElementById(ArrayOfIds[i]).style.display = "none";
   }
 }
}
function showSearchParam(StringofIds) {

 ArrayOfIds = StringofIds.split(",");
 for (i = 0; i < ArrayOfIds.length; i++) {
 try{
  document.getElementById(ArrayOfIds[i]).style.zIndex=200;
  document.getElementById(ArrayOfIds[i]).style.display = "block";
  }catch(e){
     //alert(e)
  }
 }
}

function loadDefaults() {
 setMsg();
 //screenname.innerHTML=myScreenName;
 //document.getElementById("screenname").innerHTML=myScreenName;
 try {
  //document.getElementById("modulelogo").src="../../admin/images/modulelogo_"+myModuleCode+".gif";
  //document.getElementById("moduleimage").src="../../admin/images/"+myModuleCode+"_module.gif";
  //document.getElementById("mainbodybkg").style.backgroundImage="url(../../admin/images/mainbg4.jpg)";
  //document.getElementById("mainbodybkg").style.backgroundImage.width="1280";
 } catch(e) {}
 
}

function loadDefaultsDialogWindow() {
 setMsg();
 //screenname.innerHTML=myScreenName;
 document.getElementById("screenname").innerHTML=myScreenName;

}

function enableformfields() {
   myPageForm=document.forms[0];
   i=0;
   while (i<myPageForm.length) {
    myPageForm.elements[i].disabled=false;
    i=i+1;
   }
   return true;
}

var validEnterKeyPress=false;
var active_action_image=null;
function ScreenActionOnFocus(imageID,radioid) {
 if (active_action_image!=null) {
   document.getElementById(active_action_image).style.visibility="hidden";
 }
 document.getElementById(imageID).style.visibility="visible";
 document.getElementById(radioid).checked=true;

 currentFieldFocus('screenactionlabel');
}
function ScreenActionLostFocus(object,imageID) {
 if (!object.checked) {
   document.getElementById(imageID).style.visibility="hidden";
 } else {
    active_action_image=imageID;
 } 
 currentFieldLostFocus('screenactionlabel');
}

function enterKeyAllowed(allowed,pressedfrom , e ) {  
 
  var key;     
  if (allowed) {        
    validEnterKeyPress=true;
  } else if (validEnterKeyPress && pressedfrom!='body') {      
    validEnterKeyPress=false;
  } 
     if( window.event ) {     
             key = window.event.keyCode; //IE
     }else if ( e.which ){
              key = e.which; //firefox 
     }    
     
  if (!allowed && !validEnterKeyPress) {    
       // return !(window.event && window.event.keyCode == 13);  
       return !( key == 13 );  
  }
}


var mFullMsg="";
function currentFieldFocus(objectId)
   {
   if (document.getElementById(objectId)!=null) {
    document.getElementById(objectId).src="../../admin/images/hand.gif";
   }
 }
function currentFieldLostFocus(objectId)
   {
   if (document.getElementById(objectId)!=null) {
    document.getElementById(objectId).src="../../admin/images/s.gif";
    
   }
 }
function setColorBoxBgColor(objectId)
{
 if (document.getElementById(objectId)!=null) {
   if (document.getElementById(objectId).value!="") {  
    try {
      document.getElementById("colorbox_"+objectId).style.backgroundColor="#"+document.getElementById(objectId).value;
    } catch (e) { //Entered code is invalid. therefore set the field to empty value
        document.getElementById(objectId).value="FFFFFF";
        document.getElementById("colorbox_"+objectId).style.backgroundColor="#FFFFFF";
    }
   } else {
       document.getElementById("colorbox_"+objectId).style.backgroundColor="#FFFFFF";
   }
 }
}

function showColorPicker(colorPickerInputBoxName,label,onSelectRecordFunction,schemaName) {

    myRequestParameters  = "colorPickerInputBoxName="+colorPickerInputBoxName;
    myRequestParameters += "&label="+label;
    myRequestParameters += "&onSelectRecordFunction="+onSelectRecordFunction;
    myRequestParameters += "&schemaName="+schemaName+"&";
    
    try {
        document.getElementById('colorpicker').src="../common/ColorPicker.do?"+myRequestParameters;
        myLeft=(document.body.offsetWidth-410-20)/2;
        myTop=((document.body.offsetHeight)/2)-200;
        document.getElementById('colorpicker').style.left=myLeft;
        document.getElementById('colorpicker').style.top=myTop;

        document.getElementById('colorpicker').style.visibility="visible";
        bringSelectedIframeToTop(true);
        document.getElementById('colorpicker').style.zIndex=100;
    } catch(lke1) {
          try {
            parent.document.getElementById('colorpicker').src="../common/Lookup.do?"+myRequestParameters;
            myLeft=(parent.document.body.offsetWidth-410-20)/2;
            myTop=((parent.document.body.offsetHeight)/2)-200;
            parent.document.getElementById('colorpicker').style.left=myLeft;
            parent.document.getElementById('colorpicker').style.top=myTop;
            parent.document.getElementById('colorpicker').style.visibility="visible";
            bringSelectedIframeToTop(true);
            parent.document.getElementById('colorpicker').style.zIndex=100;
          } catch(lke2) {}
    }
}

function hideColorPicker() {
    try {
     document.getElementById('colorpicker').src="../../admin/common/LookupProgressMsgPage.do";
    } catch(lke1) {
      try {
        parent.document.getElementById('colorpicker').src="../../admin/common/LookupProgressMsgPage.do";
      } catch(lke2) {}
    }
    document.getElementById('colorpicker').style.visibility="hidden";
}

function showLookup(lookupInputBoxName,label,lookupobject,reloadPageName,reloadPagePrimaryFields,displayColumns,displayColumnLabels,returnFields,primaryLookupColumn,onSelectRecordFunction,onBeforeLookupFunction,schemaName,additionalFilterFields,searchString) {
try{
  var displayLookup = true;
  if (onBeforeLookupFunction=="") {
   var displayLookup=true;
  } else {
   var displayLookup = eval(onBeforeLookupFunction);
  }
  if (displayLookup) {
  if (searchString==null || searchString==undefined) {
    try {
     searchString=parent.document.getElementById(lookupInputBoxName).value+"%";
    } catch(lke1) {
       try {
        searchString=document.getElementById(lookupInputBoxName).value+"%";
       } catch(lke2) {}
    }
  } 
  myAdditionalFilters="";
  if (additionalFilterFields!="null") {
   ArrayOfFilterFields = additionalFilterFields.split(",");
   for (i = 0; i < ArrayOfFilterFields.length; ++i) {
    ArrayOfNameValuePairs = ArrayOfFilterFields[i].split(":");
    for (j = 0; j < ArrayOfNameValuePairs.length; j=j+2) {
      additionFieldValue="";
      try {
       if (parent.document.forms[0].elements[ArrayOfNameValuePairs[j+1]].value!="") { //Add only if a value has been entered
           additionFieldValue=parent.document.forms[0].elements[ArrayOfNameValuePairs[j+1]].value;
       }
	  } catch(lke2) {}
	  try{
	   if(additionFieldValue==''){
       additionFieldValue=document.forms[0].elements[ArrayOfNameValuePairs[j+1]].value;
       }
	  }catch(lke2){}
     //Changed from like to equal as per request from Kosala due to wanting the exact condition match for additional filters
     //myAdditionalFilters += " and COALESCE(upper("+ ArrayOfNameValuePairs[j] +"),'') like COALESCE(upper('"+additionFieldValue+"'),'')";
     if (additionFieldValue!="") {
         myAdditionalFilters += " and COALESCE(upper("+ ArrayOfNameValuePairs[j] +"),'') = COALESCE(upper('"+additionFieldValue+"'),'')";
         additionFieldValue = "";
     }

    }
   }
  }
  
  myRequestParameters  = "lookupBoxFilterString="+escape(searchString);
  myRequestParameters += "&lookupInputBoxName="+lookupInputBoxName;
  myRequestParameters += "&label="+label;
  myRequestParameters += "&lookupobject="+lookupobject;
  myRequestParameters += "&reloadPageName="+reloadPageName;
  myRequestParameters += "&reloadPagePrimaryFields="+reloadPagePrimaryFields;
  myRequestParameters += "&displayColumns="+displayColumns;
  myRequestParameters += "&displayColumnLabels="+displayColumnLabels;
  myRequestParameters += "&returnFields="+returnFields;
  myRequestParameters += "&primaryLookupColumn="+primaryLookupColumn;
  myRequestParameters += "&onSelectRecordFunction="+onSelectRecordFunction;
  myRequestParameters += "&schemaName="+schemaName;
  myRequestParameters += "&additionalFilterFields="+additionalFilterFields;
  myRequestParameters += "&additionalFilters="+escape(myAdditionalFilters)+"&";
 
  try {
  if (Number(document.body.offsetHeight) > 600){
 	doctop = 576;
 	}
   document.getElementById('lookup').src="../common/Lookup.do?"+myRequestParameters;
   myLeft=(document.body.offsetWidth-670-20)/2;
   //alert(doctop)
   myTop=((doctop)/2)-200;
   document.getElementById('lookup').style.left=myLeft;
   //document.getElementById('lookup').style.top=myTop;
   document.getElementById('lookup').style.top=parent.document.body.scrollTop; 
	
   document.getElementById('lookup').style.visibility="visible";
   bringSelectedIframeToTop(true);
   document.getElementById('lookup').style.zIndex=999;
  } catch(lke1) {
     try {
	   parent.document.getElementById('lookup').src="../common/Lookup.do?"+myRequestParameters;
       myLeft=(parent.document.body.offsetWidth-670-20)/2;
       myTop=((parent.document.body.offsetHeight)/2)-200;
       parent.document.getElementById('lookup').style.left=myLeft;
       parent.document.getElementById('lookup').style.top=parent.document.body.scrollTop;
	   parent.document.getElementById('lookup').style.visibility="visible";
       bringSelectedIframeToTop(true);
	   parent.document.getElementById('lookup').style.zIndex=100;
     } catch(lke2) {}
  }

}
} catch(mainlookupcatcherr) {alert(mainlookupcatcherr);}

}

function hideLookup() {
  try {
   document.getElementById('lookup').src="../../admin/common/LookupProgressMsgPage.do";
  } catch(lke1) {
    try {
      parent.document.getElementById('lookup').src="../../admin/common/LookupProgressMsgPage.do";
    } catch(lke2) {}
  }
  document.getElementById('lookup').style.visibility="hidden";
}


function showTextEditor(textAreaFieldName,labelname) {
  myRequestParameters  = "textAreaFieldName="+textAreaFieldName;
  myRequestParameters  += "&labelname="+labelname;

  //Check if texteditor Iframe has already been added to page. If not create it.
  if (document.getElementById('texteditor')==undefined) {
    myIFrameStr="<IFRAME NAME=\"texteditor\" ID=\"texteditor\" scrolling=\"no\" class=\"lookupIFrameStyle\" framespacing=\"0\" border=\"0\" frameborder=\"0\"";
    myIFrameStr+=" STYLE=\"width:670px;height:285px;position:absolute;top:150;left:175;visibility:hidden;z-Index:170;\""; 
    myIFrameStr+=" SRC=\"../../admin/common/EditorPage.do\">";
    myIFrameStr+=" </IFRAME>";
    texteditoriframe.innerHTML=myIFrameStr;
  }
  
  document.getElementById('texteditor').src="../common/EditorPage.do?"+myRequestParameters;
  document.getElementById('texteditor').style.visibility="visible";
  bringSelectedIframeToTop(true);
  document.getElementById('texteditor').style.zIndex=200;
}

function hideTextEditor() {
    document.getElementById('texteditor').src="../common/EditorPage.do";
    document.getElementById('texteditor').style.visibility="hidden";
}
function showDialogWindow(mysrcurl,mywidth,myheight) {
//var xx = window.event.x
//alert(xx)
  try {
  //Check if dialogwindow Iframe has already been added to page. If not create it.
  if (document.getElementById('dialogwindow')==undefined) {
  
    myIFrameStr="<IFRAME NAME=\"dialogwindow\" ID=\"dialogwindow\" scrolling=\"yes\" class=\"dialogWindowIFrameStyle\" framespacing=\"0\" border=\"0\" frameborder=\"0\"";
    myIFrameStr+="    STYLE=\"width:500px;height:230px;position:absolute;top:150;left:250;visibility:hidden;z-Index:150;\""; 
    myIFrameStr+="    SRC=\"\">";
    myIFrameStr+="</IFRAME>";
    document.getElementById("dialogwindowiframe").innerHTML=myIFrameStr;
  }
     
      
      
  document.getElementById('dialogwindow').src=mysrcurl;
  //opera Netscape 6 Netscape 4x Mozilla 
  if (window.innerWidth || window.innerHeight){ 
    docwidth = window.innerWidth; 
	docheight = window.innerHeight; 
  } 
  //IE Mozilla 
  if (document.body.clientWidth || document.body.clientHeight){
  // //	 
	//docheight = document.body.clientHeight; 
	docwidth = document.body.clientWidth;
  // //	
	docheight = document.body.scrollTop;
  } 
  
  if (mywidth==0 || mywidth==undefined) {
    mywidth=docwidth-40;
  }
  if (myheight==0 || myheight==undefined) {
    myheight=docheight-90;
  }
  //alert('in side 1');
  document.getElementById('dialogwindow').style.width=mywidth;
  document.getElementById('dialogwindow').style.height=myheight;
  document.getElementById('dialogwindow').style.left=(docwidth-mywidth)/2;

  document.getElementById('dialogwindow').style.top = docheight+100;
  //document.getElementById('dialogwindow').style.top=(((docheight-myheight)/2)+50);
  document.getElementById('dialogwindow').style.visibility="visible";
  bringSelectedIframeToTop(true);
  document.getElementById('dialogwindow').style.zIndex=100;
   //alert('in side 3');
  } catch(ee) {
       alert(ee);
  }
}
function hideDialogWindow() {
    try {
    document.getElementById('dialogwindow').src="about:blank";
    document.getElementById('dialogwindow').style.visibility="hidden";
  } catch(ee) {
       alert(ee);
  }
}

function openSeperateWindow(mysrcurl,mywidth,myheight){
 //window.open(mysrcurl, "win","top=23,left=0,width="+mywidth+",height="+myheight+",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0");
 window.open(mysrcurl, "win","top=23,left=0,height="+myheight+",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0");

}


function printDialogWindow(mysrcurl) {
  try {
  document.getElementById('dialogwindow').src=mysrcurl;
  //Set the width and height to a small value and display the iframe at the left/top most corner in order not to 
  //display it to the user. note that we cannot set visibility to hidden as it will not print the iframe
  document.getElementById('dialogwindow').style.width=10;
  document.getElementById('dialogwindow').style.height=10;
  document.getElementById('dialogwindow').style.left=0;
  document.getElementById('dialogwindow').style.top=0;
  document.getElementById('dialogwindow').style.visibility="visible";
  bringSelectedIframeToTop(true);
  document.getElementById('dialogwindow').style.zIndex=100;
  toggleProgressMsg('Please Wait..','Generating Print Layout...');
 } catch(e) {alert('ok'); alert(e);}
  
}
function printDialogWindowAfterDisplay() {
  dialogwindow.focus();
  dialogwindow.print();
  document.getElementById('dialogwindow').style.visibility="hidden";
  hideProgressMsg();
}

function checkMsgArea() {
try {
  mMsgStr=messageAreaContent.innerText;
  if ((mMsgStr.length)>160) {
    mFullMsg=msgAreaText.innerText;
    msgAreaText.innerText=mMoreMsg;
    messageAreaContent.msgType="notfull";
  } else if ((mMsgStr.length)!=0) {
    mFullMsg=msgAreaText.innerText;
    messageAreaContent.msgType="full";
  }
 } catch(e) {}
}
function displayMoreMsg() {
  msgAreaText.innerText=mFullMsg;
  /*Following routine is taken off the JSCookMenu javascript. It hides any controls such as select
	dropdown boxes that overlaps the message area*/
  if (!messageAreaContent.cmOverlap)
	messageAreaContent.cmOverlap = new Array ();            	
  cmHideControl ("IFRAME", messageAreaContent);
  cmHideControl ("SELECT", messageAreaContent);
  cmHideControl ("OBJECT", messageAreaContent);            	
}

function hideMoreMsg() {
  if (messageAreaContent.msgType!="full" && mFullMsg!="") {
	  /* Following routine is taken off the JSCookMenu javascript. It shows any controls such as select
	  dropdown boxes that were hidden when displaying the message area*/
	  cmShowControl (messageAreaContent);
	  msgAreaText.innerText=mMoreMsg;
   }
}
function disableInput(mInputNames) {
	var myInputNames=mInputNames.split(",");
	for (i=0; i<myInputNames.length; i++) {
	    //cmGetObject taken from the JSCookMenu javascripts
		document.getElementById(myInputNames[i]).className="disabledInputText";
		document.getElementById(myInputNames[i]).disabled=true;
		id = document.getElementById(myInputNames[i]+"_star");
        //Since all input boxes will not have a required symbol, block the script error if the symbol is not available
        try {
		  document.getElementById(myInputNames[i]+"_star").style.visibility="hidden";
		} catch(e) {}
        //Since all input boxes will not have a lookup box, block the script error if the lookup is not available
        try {
		  document.getElementById(myInputNames[i]+"_lkup").style.visibility="hidden";
		} catch(e) {}

	}
}
		 
function enableInput(mInputNames) {
	var myInputNames=mInputNames.split(",");
	for (i=0; i<myInputNames.length; i++) {
	    //cmGetObject taken from the JSCookMenu javascripts
		document.getElementById(myInputNames[i]).disabled=false;
		document.getElementById(myInputNames[i]).className="inputText";
		id = document.getElementById(myInputNames[i]+"_star");
        //Since all input boxes will not have a required symbol, block the script error if the symbol is not available
        try {
		  document.getElementById(myInputNames[i]+"_star").style.visibility="visible";
		} catch(e) {}

        //Since all input boxes will not have a lookup box, block the script error if the lookup is not available
        try {
		  document.getElementById(myInputNames[i]+"_lkup").style.visibility="visible";
		} catch(e) {}
	}
}

function MainMenu_MouseOver(id) {
    if(id.className!="selected" && id.className!="selected hover") {
    	id.className = "hover"; 
    } 
    else {
    	id.className = "selected hover";  
    };
    return false;
};

function MainMenu_MouseOut(id) {
    if(id.className!="selected" && id.className!="selected hover") {id.className = ""} else {id.className = "selected";};
    return false;   
}

function SubMenu_MouseOver(idname){

    id = document.getElementById(idname);
    bulletImage = document.getElementById(idname+"_bulletArrow");
    if(id.className!="selected" && id.className!="selected hover") {
    	id.className = "hover"; 
    } 
    else {
    	id.className = "selected hover";  
    };
   
    return false;
}

function SubMenu_MouseOut(idname){
    id = document.getElementById(idname);
    bulletImage = document.getElementById(idname+"_bulletArrow");
    if(id.className!="selected" && id.className!="selected hover") {
    	id.className = "";
    } else {
    	id.className = "selected";
    };

    return false;   
}

function selectedMenuItemHighlight() {

 try {
     //Main Menu
 	 var g_selectedMainMenu = document.getElementById(m_mainmenuid);
	 g_selectedMainMenu.className = "selected";
 
     //Sub menu
     if (m_submenuid!='Default') {
	 	var g_selectedSubMenu = document.getElementById(m_submenuid);
		g_selectedSubMenu.className = "selected";
	 }
 } catch (e) {
	alert(e.toString());
 }
}
			
function display_alert_msg(v_Msg) {
	msgAreaText.innerText=v_Msg;
}
		
function close_alert_msg() {
	msgAreaText.innerText="";
}

/*
Created by: 
Glenn G. Vergara
glenngv@yahoo.com
Philippines
*/

var typed="";
function s1(objSelect,e,notfound,autotab){
	var code=(document.all)?event.keyCode:e.which;
	if (code==27){//ESC key
		typed="";
		window.status='';
		objSelect.selectedIndex=0;
		return false;
	}
	else if (code==9){//TAB key
		typed="";
		window.status='';
		return true;
	}
	var letter = String.fromCharCode(code);
	typed+=letter;
	window.status=typed;
	if (document.all){
		for (var i=0;i<objSelect.options.length;i++){
			//override SELECT behavior of auto-selecting option on press of the first letter of the item
			if (objSelect.options[i].text.substring(0,1).toUpperCase()==letter)
				return s2(objSelect,e,notfound,autotab); //return false;
		}
	}
                if (document.all) {
		//for IE
		return s2(objSelect,e,notfound,autotab);
	}					
	else{	
		//for NS6 and up (put a little delay to supercede the SELECT behavior of auto-selecting option on press of the first letter of the item)
		setTimeout("s2(document.forms['"+objSelect.form.name+"'].elements['"+objSelect.name+"'])",1); 	
	}
}

function s2(objSelect,e,notfound,autotab){
	for (var i=0;i<objSelect.options.length;i++){
		if (objSelect.options[i].text.toUpperCase().indexOf(typed)==0){
			objSelect.selectedIndex=i;
			mSelLen=objSelect.options[i].text.toUpperCase().length;
			if (typed.length==mSelLen && autotab=='yes') {
				aa=autoTab(objSelect, mSelLen, e);
				typed="";
			}
			return false;
		}
	}
	if (notfound=='top') {
		objSelect.selectedIndex=0;
	}
	typed="";
	return false;	//always return false
}
<!-- Original:  Cyanide_7 (leo7278@hotmail.com) -->
<!-- Web Site:  http://members.xoom.com/cyanide_7 -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
 try {
  var keyCode = (isNN) ? e.which : e.keyCode; 
  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
  input.form[(getIndex(input)+1) % input.form.length].focus();
  function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
      if(arr[index] == ele)
         found = true;
      else
         index++;
         return found;
      }
  function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
      if (input.form[i] == input)index = i;
      else i++;
      return index;
   }
    return true;
 } catch(e) {}
}
//  End -->

function clearStatusMsg() {
  window.status='';
  return true;
}
/***********************************************
* Cool DHTML tooltip script- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var CalPosX = null;
var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetitle,thetext, thecolor, thewidth){
if (ns6||ie){
 if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
 if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
 myInnerHtml="<div class='dhtmltooltiptitle'>";
 myInnerHtml+="<span><b>&nbsp;</b></span>";
 myInnerHtml+="<span><b>"+thetitle+"</b></span></div>";
 myInnerHtml+="<div><span style='padding-left:2px;'>"+thetext+"</span></div>";
 tipobj.innerHTML=myInnerHtml;
 //tipobj.style.visibility="visible";
 //alert(tipobj.innerHTML);
 enabletip=true;
 positiontip();
 return false
}
}
function positiontip(){
 try {
 //if (showcal) {
 //CalPosX=window.event.clientX + document.body.scrollLeft;
 //alert(CalPosX);
 //}
 if (enabletip){
 var curX=(ns6)?e.screenX : event.x+ietruebody().scrollLeft;
 var curY=(ns6)?e.screenY : event.y+ietruebody().scrollTop;
  
  //Find out how close the mouse is to the corner of the window
  var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
  var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
  var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
  //if the horizontal distance isn't enough to accomodate the width of the context menu
  if (rightedge<tipobj.offsetWidth)
  //move the horizontal position of the menu to the left by it's width
   tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
  else if (curX<leftedge)
   tipobj.style.left="20px"
  else
   //position the horizontal position of the menu where the mouse is positioned
   tipobj.style.left=curX+offsetxpoint+"px"

   //same concept with the vertical position
   if (bottomedge<tipobj.offsetHeight)
    tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
   else
    tipobj.style.top=curY+offsetypoint+"px"
    tipobj.style.visibility="visible"
 }
 } catch(e) {}//alert(e);}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

/***
calculate sell rate - Rates Peiord basis
*/
    
 function fnFillSellRateData(obj,arrObj,objPos){      
 //alert("Hi");
 //alert(len);

   for(i=1;i<=len;i++){
     if(doc.elements[fixObj][i-1].checked){
     	//alert(i);   
     	//alert("fnFillSelected"+i+"Day");
       eval("fnFillSelected"+i+"Day(obj,arrObj,objPos);");
       break;
     }
   }	
   if( (arrObj=='netRateArray') || (arrObj=='sellRateArray') ){
      fnCalcProfit(obj,arrObj,objPos);      
   }else if(arrObj=='adnlAdultNetArray' || arrObj=='adnlAdultsellRateArray'){
      fnCalcAddAdultProfit(obj,arrObj,objPos);   
   }else if(arrObj=='childNetRateArray' || arrObj=='childsellRateArray'){   
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray1' || arrObj=='multiChildSellRateArray1'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray2' || arrObj=='multiChildSellRateArray2'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray3' || arrObj=='multiChildSellRateArray3'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray4' || arrObj=='multiChildSellRateArray4'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray5' || arrObj=='multiChildSellRateArray5'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray6' || arrObj=='multiChildSellRateArray6'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray7' || arrObj=='multiChildSellRateArray7'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray8' || arrObj=='multiChildSellRateArray8'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray9' || arrObj=='multiChildSellRateArray9'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }else if(arrObj=='multiChildNetRateArray10' || arrObj=='multiChildSellRateArray10'){   
      //alert("Fooo");
      fnCalcChildProfit(obj,arrObj,objPos);       
   }
 }

 function fnCalcChildProfit(obj,arrObj,objPos){
   for(i=0;i<arrObjLen;i++){
   		if(arrObj=='childNetRateArray' || arrObj=='childsellRateArray'){
   			if(doc.setupRate.value=="NS" && doc.elements["childNetRateArray["+i+"]"].value!="" && doc.elements["childsellRateArray["+i+"]"].value!="0"){
     			doc.elements["childprofitMarkupArray["+i+"]"].value = Number(doc.elements["childsellRateArray["+i+"]"].value) - Number(doc.elements["childNetRateArray["+i+"]"].value);   		     		
    		}//end if NS & non zero value validation
    	}else{    	
	    	//alert("test point 1");
    		//alert(doc.multipleRates.value);
    		
    		if(arrObj=='multiChildNetRateArray1' || arrObj=='multiChildSellRateArray1'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray1[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray1[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray1["+i+"]"].value = Number(doc.elements["multiChildSellRateArray1["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray1["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	}
   		 	
   		 	if(arrObj=='multiChildNetRateArray2' || arrObj=='multiChildSellRateArray2'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray2[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray2[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray2["+i+"]"].value = Number(doc.elements["multiChildSellRateArray2["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray2["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	}
   		 	
   		 	if(arrObj=='multiChildNetRateArray3' || arrObj=='multiChildSellRateArray3'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray3[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray3[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray3["+i+"]"].value = Number(doc.elements["multiChildSellRateArray3["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray3["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	}
   		 	
   		 	if(arrObj=='multiChildNetRateArray4' || arrObj=='multiChildSellRateArray4'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray4[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray4[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray4["+i+"]"].value = Number(doc.elements["multiChildSellRateArray4["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray4["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	}
   		 	
   		 	if(arrObj=='multiChildNetRateArray5' || arrObj=='multiChildSellRateArray5'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray5[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray5[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray5["+i+"]"].value = Number(doc.elements["multiChildSellRateArray5["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray5["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	}
   		 	
   		 	if(arrObj=='multiChildNetRateArray6' || arrObj=='multiChildSellRateArray6'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray6[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray6[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray6["+i+"]"].value = Number(doc.elements["multiChildSellRateArray6["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray6["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	}
   		 	
   		 	if(arrObj=='multiChildNetRateArray7' || arrObj=='multiChildSellRateArray7'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray7[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray7[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray7["+i+"]"].value = Number(doc.elements["multiChildSellRateArray7["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray7["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	}
   		 	
   		 	if(arrObj=='multiChildNetRateArray8' || arrObj=='multiChildSellRateArray8'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray8[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray8[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray8["+i+"]"].value = Number(doc.elements["multiChildSellRateArray8["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray8["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	}
   		 	
   		 	if(arrObj=='multiChildNetRateArray9' || arrObj=='multiChildSellRateArray9'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray9[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray9[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray9["+i+"]"].value = Number(doc.elements["multiChildSellRateArray9["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray9["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	}
   		 	
   		 	if(arrObj=='multiChildNetRateArray10' || arrObj=='multiChildSellRateArray10'){
    			if(doc.setupRate.value == "NS" && doc.elements["multiChildSellRateArray10[" + i + "]"].value != "" && doc.elements["multiChildSellRateArray10[" + i + "]"].value != "0"){
    				//alert(doc.elements["multipleRates"].value);
    				if(doc.multipleRates.value == "Y"){
    					//alert("doc.elements[multiChildSellRateArray1[" + i + "]].value ::: " + doc.elements["multiChildSellRateArray1[" + i + "]"].value);
						//alert("doc.elements[multiChildNetRateArray[" + i +"]].value::: " + doc.elements["multiChildNetRateArray["+i+"]"].value);
    					doc.elements["multiChildProfitMarkupArray10["+i+"]"].value = Number(doc.elements["multiChildSellRateArray10["+i+"]"].value) - Number(doc.elements["multiChildNetRateArray10["+i+"]"].value);     	
     				} //end if multiple rates Y    
     			}//end if NS non- zero value
   		 	} 		 	
   		 }
   }//end for
 }

 function fnCalcAddAdultProfit(obj,arrObj,objPos){
   for(i=0;i<arrObjLen;i++){
    if(doc.setupRate.value=="NS" && doc.elements["adnlAdultNetArray["+i+"]"].value!="" && doc.elements["adnlAdultsellRateArray["+i+"]"].value!="0"){
     doc.elements["adultprofitMarkupArray["+i+"]"].value=Number(doc.elements["adnlAdultsellRateArray["+i+"]"].value) - Number(doc.elements["adnlAdultNetArray["+i+"]"].value);
    }
   }
 }
  
 function fnCalcAddAdultProfit(obj,arrObj,objPos){
   for(i=0;i<arrObjLen;i++){
    if(doc.setupRate.value=="NS" && doc.elements["adnlAdultNetArray["+i+"]"].value!="" && doc.elements["adnlAdultsellRateArray["+i+"]"].value!="0"){
     doc.elements["adultprofitMarkupArray["+i+"]"].value=Number(doc.elements["adnlAdultsellRateArray["+i+"]"].value) - Number(doc.elements["adnlAdultNetArray["+i+"]"].value);
    }
   }
 }

 function fnCalcProfit(obj,arrObj,objPos){
   for(i=0;i<arrObjLen;i++){ 
    if(doc.setupRate.value=="NS" && doc.elements["netRateArray["+i+"]"].value!="" && doc.elements["sellRateArray["+i+"]"].value!="0"){
   var newVal=Number(doc.elements["sellRateArray["+i+"]"].value) - Number(doc.elements["netRateArray["+i+"]"].value);
   doc.elements["profitMarkupArray["+i+"]"].value = newVal.toFixed(2);
    
    }
   }
 }
 
/***
End calculate sell rate - Rates Peiord basis
*/

/*to get fixed inventory and rates*/

  function fnFillSelected5Day(obj,arrObj,objPos){  
    if(objPos == 2 || objPos == 3 || objPos == 4){
      for(i = 0; i < arrObjLen; i++){    
       if((i == 2|| i == 3|| i == 4) && ((doc.elements[arrObj+"["+i+"]"].value == "") || (doc.elements[arrObj+"["+i+"]"].value == "0") )){               
         doc.elements[arrObj+"["+i+"]"].value=obj.value;
       }
      }
    }else{
       for(i=0;i<arrObjLen;i++){    
        if((i==0 || i==1|| i==5|| i==6) && ( (doc.elements[arrObj+"["+i+"]"].value == "") || (doc.elements[arrObj+"["+i+"]"].value == "0")) ) {               
         doc.elements[arrObj+"["+i+"]"].value=obj.value;
        }
      }
    }
  }
 
 
  function fnFillSelected4Day(obj,arrObj,objPos){  
    if(objPos==1|| objPos==2|| objPos==3){
      for(i=0;i<arrObjLen;i++){    
       if((i==1|| i==2|| i==3) && ( (doc.elements[arrObj+"["+i+"]"].value == "") || (doc.elements[arrObj+"["+i+"]"].value == "0") )){               
         doc.elements[arrObj+"["+i+"]"].value=obj.value;
       }
      }
    }else{
       for(i=0;i<arrObjLen;i++){    
        if((i==0 || i==4|| i==5|| i==6) && ( (doc.elements[arrObj+"["+i+"]"].value == "") || (doc.elements[arrObj+"["+i+"]"].value == "0")) ) {               
         doc.elements[arrObj+"["+i+"]"].value=obj.value;
        }
      }
    }
  }
  
   function fnFillSelected3Day(obj,arrObj,objPos){  
    if(objPos==0 || objPos==1|| objPos==2|| objPos==3|| objPos==4){
      for(i=0;i<arrObjLen;i++){    
       if((i==0 || i==1|| i==2|| i==3|| i==4) && ((doc.elements[arrObj+"["+i+"]"].value == "") || (doc.elements[arrObj+"["+i+"]"].value == "0") )){               
         doc.elements[arrObj+"["+i+"]"].value=obj.value;
       }
      }
    }else{
       for(i=0;i<arrObjLen;i++){    
        if((i==5 || i==6) && ( (doc.elements[arrObj+"["+i+"]"].value == "") || (doc.elements[arrObj+"["+i+"]"].value == "0") )){               
         doc.elements[arrObj+"["+i+"]"].value=obj.value;
        }
      }
    }
   }

 function fnFillSelected2Day(obj,arrObj,objPos){ 
    if(objPos==0 || objPos==5|| objPos==6){
      for(i=0;i<arrObjLen;i++){    
       if((i==0 || i==5|| i==6) && ( (doc.elements[arrObj+"["+i+"]"].value == "") || (doc.elements[arrObj+"["+i+"]"].value == "0") )){               
         doc.elements[arrObj+"["+i+"]"].value=obj.value;
       }
      }
    }else{
       for(i=0;i<arrObjLen;i++){    
        if((i==1 || i==2|| i==3 || i==4) && ( (doc.elements[arrObj+"["+i+"]"].value == "") || (doc.elements[arrObj+"["+i+"]"].value == "0")) ){               
         doc.elements[arrObj+"["+i+"]"].value=obj.value;
        }
      }
    }
 }
    
 function fnFillSelected1Day(obj,arrObj,objPos){
  if(objPos==0){
   for(i=1;i<arrObjLen;i++){
    if( (doc.elements[arrObj+"["+i+"]"].value == "") || (doc.elements[arrObj+"["+i+"]"].value == "0") ){
     doc.elements[arrObj+"["+i+"]"].value=obj.value;
    }
   }
  }
 }
 
 function fnFillData(obj,arrObj,objPos){      
   for(i=1;i<=len;i++){
     if(doc.elements[fixObj][i-1].checked){
     	//alert(i);
       eval("fnFillSelected"+i+"Day(obj,arrObj,objPos);");
       break;
     }
   }   
 }
function setFilterTodayRange(startDate,EndDate) {
 myTodayStartDate=startDate;
 myTodayEndDate=EndDate;
}
function setFilterYesterdayRange(startDate,EndDate) {
 myYesterdayStartDate=startDate;
 myYesterdayEndDate=EndDate;
}
function setFilterThisWeekRange(startDate,EndDate) {
 myWeekStart=startDate;
 myWeekEnd=EndDate;
}
function setFilterLastWeekRange(startDate,EndDate) {
 myLastWeekStart=startDate;
 myLastWeekEnd=EndDate;
}
function setFilterThisMonthRange(startDate,EndDate) {
 myMonthStart=startDate;
 myMonthEnd=EndDate;
}
function setFilterLastMonthRange(startDate,EndDate) {
 myLastMonthStart=startDate;
 myLastMonthEnd=EndDate;
}

function adjustDateInputs(element,startField,endField) {
 if (element.value=='today') {
  adjustDateSelectFields(startField,myTodayStartDate);
  adjustDateSelectFields(endField,myTodayEndDate);
 } else if (element.value=='yesterday') {
  adjustDateSelectFields(startField,myYesterdayStartDate);
  adjustDateSelectFields(endField,myYesterdayEndDate);
 } else if (element.value=='thisweek') {
  adjustDateSelectFields(startField,myWeekStart);
  adjustDateSelectFields(endField,myWeekEnd);
 } else if (element.value=='lastweek') {
  adjustDateSelectFields(startField,myLastWeekStart);
  adjustDateSelectFields(endField,myLastWeekEnd);
 } else if (element.value=='thismonth') {
  adjustDateSelectFields(startField,myMonthStart);
  adjustDateSelectFields(endField,myMonthEnd);
 } else if (element.value=='lastmonth') {
  adjustDateSelectFields(startField,myLastMonthStart);
  adjustDateSelectFields(endField,myLastMonthEnd);
 } 
}

function adjustDateSelectFields(dateField,adjDate) {
   myPageForm=document.forms[0];
   myFieldName=dateField.name+'_Month';
   for(i=0;i<myPageForm.elements[myFieldName].length;i++){
    if (myPageForm.elements[myFieldName].options[i].text==adjDate.substr(0,3)) {
      myPageForm.elements[myFieldName].options.selectedIndex=i;
      thisObj=myPageForm.elements[myFieldName];
      //Run the date object function that sets the number of days for the selected month
      eval(dateField.name + "_Object.changeMonth(thisObj)");
    }
   }
   myFieldName=dateField.name+'_Day';
   for(i=0;i<myPageForm.elements[myFieldName].length;i++){
    if (myPageForm.elements[myFieldName].options[i].text==adjDate.substr(4,2)) {
      myPageForm.elements[myFieldName].options.selectedIndex=i;
      thisObj=myPageForm.elements[myFieldName];
      //Run the date object function to set the date
      eval(dateField.name + "_Object.changeDay(thisObj)");
    }
   }
   myFieldName=dateField.name+'_Year_ID';
   for(i=0;i<myPageForm.elements[myFieldName].length;i++){
    if (adjDate.length==9) {
     myYear=adjDate.substr(7,2);
    } else {
     myYear=adjDate.substr(7,4);
    }
    if (myPageForm.elements[myFieldName].options[i].text==myYear) {
      myPageForm.elements[myFieldName].options.selectedIndex=i;
      thisObj=myPageForm.elements[myFieldName];
      //Run the date object function to set the date
      eval(dateField.name + "_Object.checkYear(thisObj)");
    }
   }
}


function showMoreRooms(tbl){
startRow=1;
tmpclass="hotrow3";
tmploaded=document.forms[0].elements[tbl+"_MoreRoomsLoaded"].value;
if (tmploaded=="true"){return;}
tmptotrooms=Number(document.forms[0].elements[tbl+"_NoTypes"].value);
a=0;
for (a=0; a<tmptotrooms; a++){
startRow=startRow+1;
if (tmpclass=="hotrow3"){tmpclass="hotrow2";}else{tmpclass="hotrow3";}
tmproom_more=eval(tbl+"_Room"+(a+1)+"_more");
for (b=0; b<tmproom_more; b++){
tmparr=""+tbl+"_Room"+(a+1)+"_data"+(b+1)+"";
tmpRoomno=a+1;
//alert("getRateRow("+tmpclass+","+tbl+","+tmparr+","+tmpRoomno+","+startRow+")");
getRateRow(tmpclass,tbl,tmparr,tmpRoomno,startRow);
startRow=startRow+1;
}
}
//hotTable1_MoreRoomsLoaded
document.forms[0].elements[tbl+"_MoreRoomsLoaded"].value="true";
}

function getRateRow(clss,tbl,valArr,tmpRoomno,startRow){
tmptbl = document.getElementById(tbl);
tmprow = tmptbl.insertRow(startRow);
tmpArr=eval(valArr);
tempcell=null;
tempcell=tmprow.insertCell(0);
tempcell.className=clss;
tempcell.align="right";
ratestr=""+tmpArr[tmpArr.length-3]+"@"+tmpArr[tmpArr.length-1]+"@"+tmpArr[tmpArr.length-1]+"";
tempcell.innerHTML="<input name=\"radio_"+tbl+"_room"+tmpRoomno+"\" type=\"radio\"  value=\"\" onClick=\"modifyRatesTBL('"+tmpRoomno+"','"+ratestr+"');\">";
var tmpInc=1;
for (k=0; k<tmpArr.length; k ++){
tempcell=tmprow.insertCell(k+1);
tempcell.className=clss;
if (k>1){
tempcell.align="right";
tmpInc=tmpInc+1;
}

tempcell.innerHTML=tmpArr[k];
}

}


function modifyRatesTBL(roomNo,Rates){
//alert(roomNo+"   "+Rates);
}




var rate_tblID_shown="";
var prev_rate_tbl="";

function showRates(tbl){
if (document.images[tbl+"_select"].src.indexOf("unselect")>-1){
document.images[tbl+"_select"].src="../../admin/images/but_select.gif";
document.all[tbl+"_rates"].innerHTML="<img src=\"../../admin/images/s.gif\" alt=\"\" width=\"1\" height=\"1\" border=\"0\">";
rate_tbl_shown="";
}else{
document.images[tbl+"_select"].src="../../admin/images/but_unselect.gif";
if (prev_rate_tbl!=""){
document.images[prev_rate_tbl+"_select"].src="../../admin/images/but_select.gif";
document.all[prev_rate_tbl+"_rates"].innerHTML="<img src=\"../../admin/images/s.gif\" alt=\"\" width=\"1\" height=\"1\" border=\"0\">";
}
document.all[tbl+"_rates"].innerHTML=getRateData(tbl);
rate_tbl_shown=tbl+"_rates";
}
prev_rate_tbl=tbl;
}


function getRateData(tbl){
data="<table width=\"60%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr valign=\"top\">"+
"<td><table width=\"100%\" border=\"0\" align=\"left\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr>"+
"<td><table width=\"100%\" height=\"15\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr>"+
"<td width=\"7\" valign=\"bottom\"><img src=\"../../admin/images/con1_tl.gif\" alt=\"\" width=\"7\" height=\"7\"></td>"+
"<td width=\"100%\" class=\"legentbg\">&nbsp;&nbsp;<span class=\"legendhead\">&nbsp;Rate Details&nbsp;</span></td>"+
"<td width=\"7\" valign=\"bottom\"><img src=\"../../admin/images/con1_tr.gif\" alt=\"\" width=\"7\" height=\"7\"></td>"+
"</tr>"+
"</table>"+
"<table width=\"100%\" class=\"roundframetable\" border=\"0\" align=\"left\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr valign=\"top\">"+
"<td width=\"96%\" align=\"center\" valign=\"middle\" bgcolor=\"#F7FBFF\">"+
"<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr>"+
"<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"1\" height=\"3\" border=\"0\"></td>"+
"</tr>"+
"<tr valign=\"top\">"+
"<td><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"1\" class=\"bg5\">"+
"<tr align=\"right\">"+
"<td align=\"left\" width=\"16%\" class=\"hotrow2\">Date</td>"+
"<td class=\"hotrow2\" width=\"16%\">Rooms</td>"+
"<td class=\"hotrow2\" width=\"17%\">Room Rate</td>"+
"<td class=\"hotrow2\" width=\"17%\">Ad: Adult Rate</td>"+
"<td class=\"hotrow2\" width=\"17%\">Child Rate</td>"+
"<td class=\"hotrow2\" width=\"17%\">Total ($)</td>"+
"</tr>"+
"<tr align=\"right\">"+
"<td align=\"left\" class=\"hotrow1\">Aug-14- 2005</td>"+
"<td class=\"hotrow1\">0</td>"+
"<td class=\"hotrow1\">0.00</td>"+
"<td class=\"hotrow1\">0.00</td>"+
"<td class=\"hotrow1\">0.00</td>"+
"<td class=\"hotrow1\">0.00</td>"+
"</tr>"+
"<tr align=\"right\">"+
"<td align=\"left\" class=\"hotrow1\">Aug-15-2005</td>"+
"<td class=\"hotrow1\">0</td>"+
"<td class=\"hotrow1\">0.00</td>"+
"<td class=\"hotrow1\">0.00</td>"+
"<td class=\"hotrow1\">0.00</td>"+
"<td class=\"hotrow1\">0.00</td>"+
"</tr>"+
"<tr align=\"right\" align=\"right\">"+
"<td class=\"hotrow2\" colspan=\"5\">Sub Total ($)&nbsp;:&nbsp;</td>"+
"<td class=\"hotrow2\" width=\"17%\"></td>"+
"</tr>"+
"<tr align=\"right\" align=\"right\">"+
"<td class=\"hotrow2\" colspan=\"5\">Discounts (Max allowed: 0.00) ($)&nbsp;:&nbsp;</td>"+
"<td class=\"hotrow2\" width=\"17%\"></td>"+
"</tr>"+
"<tr align=\"right\" align=\"right\">"+
"<td class=\"hotrow2\" colspan=\"5\">Tax / Service Fee&nbsp;:&nbsp;</td>"+
"<td class=\"hotrow2\" width=\"17%\"></td>"+
"</tr>"+
"<tr align=\"right\" align=\"right\">"+
"<td class=\"hotrow2\" colspan=\"5\">Total Payable ($)&nbsp;:&nbsp;</td>"+
"<td class=\"hotrow2\" width=\"17%\"></td>"+
"</tr>"+
"</table></td>"+
"</tr>"+
"</table>"+
"</td></tr></table>"+
"</td>"+
"</tr>"+
"<tr>"+
"<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"+
"<tr>"+
"<td width=\"7\" rowspan=\"2\"><img src=\"../../admin/images/con1_bl.gif\" alt=\"\" width=\"7\" height=\"7\"></td>"+
"<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"1\" height=\"6\"></td>"+
"<td width=\"7\" rowspan=\"2\"><img src=\"../../admin/images/con1_br.gif\" alt=\"\" width=\"7\" height=\"7\"></td>"+
"</tr>"+
"<tr>"+
"<td class=\"bg3\"><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"1\" height=\"1\"></td>"+
"</tr>"+
"</table></td>"+
"</tr>"+
"</table>";
return data;
}


function addChildDetails(value){
tmp_txt="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
for (a=0; a<(value-1); a++){
tmp_txt=tmp_txt+"<tr>"+
"<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"3\" height=\"21\" border=\"0\"></td>"+
"<td width=\"40\" class=\"Label\">Room "+(a+2)+"</td>"+
"<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"2\" height=\"1\" border=\"0\"></td>"+
"<td><select name=\"sel_No_Adults_"+(a+2)+"\" style=\"width:40px;\" class=\"dropdownStyle\">"+
"<option value=\"1\">1</option>"+
"<option value=\"2\">2</option>"+
"<option value=\"3\">3</option>"+
"<option value=\"4\">4</option>"+
"<option value=\"5\">5</option>"+
"<option value=\"6\">6</option>"+
"</select></td>"+
"<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"2\" height=\"1\" border=\"0\"></td>"+
"<td><select name=\"sel_No_Children_"+(a+2)+"\" style=\"width:40px;\" class=\"dropdownStyle\">"+
"<option value=\"0\">0</option>"+
"<option value=\"1\">1</option>"+
"<option value=\"2\">2</option>"+
"<option value=\"3\">3</option>"+
"<option value=\"4\">4</option>"+
"<option value=\"5\">5</option>"+
"<option value=\"6\">6</option>"+
"</select></td>"+
"<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"2\" height=\"1\" border=\"0\"></td>"+
"</tr>";
}
tmp_txt=tmp_txt+"</table>";
//alert(tmp_txt);
roomdata.innerHTML=tmp_txt;
a=0;
}
function openRezgSite() {
    window.open("http://www.rezgateway.com");
}

    /**
    * Short form function for <code>document.getElementById()</code>
    * <br>Added by chinthaka
    * <p>
    * @param id Id of the element - required.
    * @param myForm The form name or index - optional.
    * @param deepFind Boolean, specifies object to be search within any form in the document.
    * @return the element that having passed id.
    * @see document.getElementById()     */	
	function $(id, myForm, deepFind){
		try{
			if (typeof(id) == "string"){
				var obj = null;
				if (myForm != null){
					if (typeof(myForm) == "string"){
						//getting obj by form name
						obj = eval("document.forms['" + myForm + "']." + id);
					}
					else{
						//getting obj by form index
						obj = eval("document.forms[" + myForm + "].elements['" + id + "']");
					}
				}else{
					//getting obj by id
					obj = document.getElementById(id);
				}
				if (obj == null && deepFind != null && deepFind == true){
					//try to find obj from other forms if enabled
					for(var i=0; i<10; i++){
						obj = eval("document.forms[" + i + "]." + id);
						if (obj != null) break;
					}
				}
				return obj;
			}
			else{
				return id;
			}
		}catch(e){
			window.status = e;
		}
	}
	
    /**
    * Short form function for <code>document.getElementsByName()</code>
    * <br>Added by chinthaka
    * <p>
    * @param name Name of the elements to be returned - required.
    * @return Array of elements having the name - name.
    * @see document.getElementsByName()
    */
	function $arr(name){
		if (typeof(name) == "string")
			return document.getElementsByName(name);
		else{
			return null;
		}	
	}
	
    /**
    * Trims the white space characters from left
    * <p>
    * @param str String to be trimmed - required.
    * @return Trimmed String
    */
	function trimLeft(str) {
	    return str.replace( /^\s*/, "" );
	}
	
    /**
    * Trims the white space characters from right
    * <p>
    * @param str String to be trimmed - required.
    * @return Trimmed String
    */
	function trimRight(str) {
	    return str.replace( /\s*$/, "" );
	}
	
    /**
    * Trims the white space characters from left and right
    * <p>
    * @param str String to be trimmed - required.
    * @return Trimmed String
    */
	function trim(str) {
	    return trimLeft(trimRight(str));
	}
	
    /**
    * Trims the white space characters from left and right and mid
    * <p>
    * @param str String to be trimmed - required.
    * @return Trimmed String
    */
	function trimFull(str) {
	    return str.replace(/\s+/g,"");
	}
	
	
//////////////////IFRAME TOOL TIP/////////////////////////////////
// Free for any type of use so long as original notice remains unchanged.
// Report errors to feedback@ashishware.com
//Copyrights 2006, Ashish Patil , ashishware.com
//Added By Rajan, Rezgateway
//ResPkgSearchCrit.jsp, SelectEngine_split1.jsp pages related to this
//////////////////////////////////////////////////////////////////////////

function ToolTip(id,isAnimated,aniSpeed)
{ var isInit = -1;
  var frm,divWidth,divHeight;
  var xincr=10,yincr=10;
  var animateToolTip =false;
  var html;
  
  function Init(id)
  {
   frm = document.getElementById(id);
   if(frm==null) return;
   
   if((frm.style.width=="" || frm.style.height==""))
   {alert("Both width and height must be set");
   return;}
   
   divWidth = parseInt(frm.style.width);
   divHeight= parseInt(frm.style.height);
   if(frm.style.overflow!="hidden")frm.style.overflow="hidden";
   if(frm.style.display!="none")frm.style.display="none";
   if(frm.style.position!="absolute")frm.style.position="absolute";
   
   if(isAnimated && aniSpeed>0)
   {xincr = parseInt(divWidth/aniSpeed);
    yincr = parseInt(divHeight/aniSpeed);
    animateToolTip = true;
    }
        
   isInit++; 
   
  }
  
    
  this.Show =  function(e,srcpath)
  {
    if(isInit<0) return;
    
    var newPosx,newPosy,height,width;
    if(typeof( document.documentElement.clientWidth ) == 'number' ){
    width = document.body.clientWidth;
    height = document.body.clientHeight;}
    else
    {
    width = parseInt(window.innerWidth);
    height = parseInt(window.innerHeight);
    
    }
    var curPosx = (e.x)?parseInt(e.x):parseInt(e.clientX);
    var curPosy = (e.y)?parseInt(e.y):parseInt(e.clientY);
    
    frm.src=srcpath;
    
    if((curPosx+divWidth+10)< width)
    newPosx= curPosx+10;
    else
    newPosx = curPosx-divWidth;

    if((curPosy+divHeight)< height)
    newPosy= curPosy;
    else
    newPosy = curPosy-divHeight-10;

   if(window.pageYOffset)
   { newPosy= newPosy+ window.pageYOffset;
     newPosx = newPosx + window.pageXOffset;}
   else
   { newPosy= newPosy+ document.body.scrollTop;
     newPosx = newPosx + document.body.scrollLeft;}

    frm.style.display='block';
    //debugger;
    //alert(document.body.scrollTop);
    frm.style.top= newPosy + "px";
    frm.style.left= newPosx+ "px";

    frm.focus();
    if(animateToolTip){
    frm.style.height= "0px";
    frm.style.width= "0px";
    ToolTip.animate(frm.id,divHeight,divWidth);}
      
    
    }

    

   this.Hide= function(e)
    {frm.style.display='none';
    if(!animateToolTip)return;
    frm.style.height= "0px";
    frm.style.width= "0px";}
    
    
    ToolTip.animate = function(a,iHeight,iWidth)
  { a = document.getElementById(a);
         
   var i = parseInt(a.style.width)+xincr ;
   var j = parseInt(a.style.height)+yincr;  
   
   if(i <= iWidth)
   {a.style.width = i+"px";}
   else
   {a.style.width = iWidth+"px";}
   
   if(j <= iHeight)
   {a.style.height = j+"px";}
   else
   {a.style.height = iHeight+"px";}
   
   if(!((i > iWidth) && (j > iHeight)))      
   setTimeout( "ToolTip.animate('"+a.id+"',"+iHeight+","+iWidth+")",1);
    }
    
   Init(id);
}
////////////    IFRAME TOOL TIP END /////////////////////
	