
var win=null;var icSkinDir='';function icDisplayStatusMsg(msgStr)
{status=msgStr
document.MM_returnValue=true;}
var winFullScreen=null;function openWinFullScreen(mypage,myname,scrollbar,toolbar,pos,margin){w=screen.width-125;h=screen.height-125;if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?((screen.height-h)-20)/2:100;TopPosition=TopPosition-10}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollbar+',location=no,directories=no,status=no,menubar=no,toolbar='+toolbar+',resizable=yes';winFullScreen=window.open(mypage,myname,settings);if(winFullScreen.focus){winFullScreen.focus();}}
var WinHS=null;function openHS(mypage,myname,scrollbar,toolbar,pos,w){h=screen.height-125;LeftPosition=65;TopPosition=(screen.height)?((screen.height-h)-20)/2:100;TopPosition=TopPosition-10;settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollbar+',location=no,directories=no,status=no,menubar=no,toolbar='+toolbar+',resizable=yes';WinHS=window.open(mypage,myname,settings);if(WinHS.focus){WinHS.focus();}}
function showModalDialogIfPossible(theurl,thestring,thedimensions)
{strAppVersion=navigator.appVersion;if(strAppVersion.indexOf('MSIE')==-1&&strAppVersion.indexOf('Safari')==-1){return window.open(theurl,thestring,thedimensions,true);}
else
{return window.showModalDialog(theurl,thestring,thedimensions);}}
var winFullScreen=null;function openWindowScreen(mypage,myname,scrollbar,toolbar,pos,margin)
{w=screen.width-125;h=screen.height-125;if(pos=="center")
LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?((screen.height-h)-20)/2:100;TopPosition=TopPosition-10
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollbar+',location=no,directories=no,status=no,menubar=no,toolbar='+toolbar+',resizable=yes';winFullScreen=window.open(mypage,myname,settings);if(winFullScreen.focus)
winFullScreen.focus();}
function OpenWin(sPageURL,sWinType,bUnique,sWinWidth,sWinHeight,bScrollBars)
{var nDefaultWidth=650;var nDefaultHeight=550;var nDefaultScroll=1;var nScroll;var dTime;var win;if(sPageURL!=null){if(sWinWidth==null)sWinWidth=nDefaultWidth;if(sWinHeight==null)sWinHeight=nDefaultHeight;if(bScrollBars==null||bScrollBars==true)
nScroll=nDefaultScroll;else
nScroll=0;dTime=new Date();if(bUnique==null)
bUnique=true;if(bUnique==true)
sWinType=sWinType+dTime.getUTCHours()+dTime.getUTCMinutes()+dTime.getUTCSeconds()+dTime.getUTCMilliseconds();win=window.open(sPageURL,sWinType,'left=75,top=75,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+nScroll+',resizable=1,width='+sWinWidth+',height='+sWinHeight);win.focus();return win;}}
function PrintFrame(target)
{if(target.length>0&&target!='_self'){if(target!='_parent'){parent.frames(target).focus();}
else{parent.focus();}}
print();}
function oHW(pageKey,sectionName,subSectionName,appRoot)
{settings=''
settings+='width=415,'
settings+='height=650,'
settings+='top=50,'
settings+='left=50,'
settings+='scrollbars=yes,'
settings+='status=yes,'
settings+='resizable=yes,'
settings+='toolbar=no'
helpURL=appRoot+'/help/ic/context/displayHelpLoading.asp';win=window.open(helpURL,'icHelp',settings);document.helpHeaderValues.pageKey.value=pageKey
document.helpHeaderValues.sectionName.value=sectionName
document.helpHeaderValues.subSectionName.value=subSectionName
document.helpHeaderValues.submit();if(win.focus){win.focus();}}
var AssocPopUp=null;function AssociateLaunch(assocType){w=1000;h=750;LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?((screen.height-h)-20)/2:100;TopPosition=TopPosition-10
if(assocType==0){url="/ic/Costings/AssociateDocumentFrame.asp"}
else if(assocType==1){url="/ic/Costings/AssociateGenItemFrame.asp";}
else if(assocType==2){url="/ic/Costings/AssociateGenItemFrame.asp?incoming=-1";}
else{alert("Error: Associate Launch Type Not Recognised");return;}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';AssocPopUp=window.open(url,"AssocPopUp",settings);var tempAction=document.forms[0].action;var tempTarget=document.forms[0].target;var tempEncType=document.forms[0].encoding;document.forms[0].action=url;document.forms[0].target="AssocPopUp";document.forms[0].encoding="application/x-www-form-urlencoded";document.forms[0].submit();document.forms[0].action=tempAction;document.forms[0].target=tempTarget;document.forms[0].encoding=tempEncType;if(AssocPopUp.focus){AssocPopUp.focus();}}
function AssociateProcessLaunch(assocType,GID,BaseGID){w=1000;h=750;LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?((screen.height-h)-20)/2:100;TopPosition=TopPosition-10;if(assocType==1)
url="/ic/GenAdmin/ItemNewAssociateGenItemFrame.asp?ListAssociatedGen=-1&BatchRespond=1&IDGenItemGroup="+GID+"&BaseGID="+BaseGID+"";else if(assocType==2)
url="/ic/GenAdmin/WorkPackageAssociationFrame.asp?BatchRespond=1&IDGenItemGroup="+GID+"&IDGenItemType=7&BaseGID="+BaseGID+"";else if(assocType==3)
url="/ic/GenAdmin/ItemNewAssociateDocumentFrame.asp?BatchRespond=1&IDGenItemGroup="+GID+"&IDGenItemType=0&Skip=0&Response=0&BaseGID="+BaseGID+"";settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';AssocPopUp=window.open(url,"AssocPopUp",settings);var tempAction=document.forms[0].action;var tempTarget=document.forms[0].target;var tempEncType=document.forms[0].encoding;document.forms[0].action=url;document.forms[0].target="AssocPopUp";document.forms[0].encoding="application/x-www-form-urlencoded";document.forms[0].submit();document.forms[0].action=tempAction;document.forms[0].target=tempTarget;document.forms[0].encoding=tempEncType;if(AssocPopUp.focus){AssocPopUp.focus();}}
var Calendar;function pickDate(Src,SetAll,Func)
{var target="";var newLeft=(window.screenLeft+325-100);var newTop=(window.screenTop+275-80);if(SetAll==null)
{target="/BIW/Utils/CalendarPopUp.aspx?src="+Src;winSetting='dialogHeight:170px;dialogWidth:210px;center:yes;help:no;resizable:yes;scroll:no;status:no;';}
else
{target="/BIW/Utils/CalendarPopUp.aspx?src="+Src+"&SetAll="+SetAll+"&Func="+Func;winSetting='dialogHeight:190px;dialogWidth:210px;center:yes;help:no;resizable:no;scroll:no;status:no;';}
if(Calendar)
{if(!Calendar.closed)
{Calendar.close();}}
Calender=window.showModalDialog(target,window,winSetting);}
function pickDateNew(Src,SetAll,Func)
{var target="";var newLeft=(window.screenLeft+325-100);var newTop=(window.screenTop+275-80);if(SetAll==null)
{target="/BIW/Utils/ClientCalendar.aspx?src="+Src;winSetting='dialogHeight:210px;dialogWidth:210px;center:yes;help:no;resizable:yes;scroll:no;status:no;';}
else
{target="/BIW/Utils/ClientCalendar.aspx?src="+Src+"&SetAll="+SetAll+"&Func="+Func;winSetting='dialogHeight:230px;dialogWidth:210px;center:yes;help:no;resizable:no;scroll:no;status:no;';}
if(Calendar)
{if(!Calendar.closed)
{Calendar.close();}}
Calender=window.showModalDialog(target,window,winSetting);}
function pickDateAjaxNew(selectMonths)
{var target="";var newLeft=(window.screenLeft+325-100);var newTop=(window.screenTop+275-80);target='/BIW/Utils/AjaxCalendarPopup.aspx?selectMonths='+selectMonths;winSetting='dialogHeight:260px;dialogWidth:220px;center:yes;help:no;resizable:yes;scroll:no;status:no;';if(Calendar)
{if(!Calendar.closed)
{Calendar.close();}}
Calender=window.showModalDialog(target,window,winSetting);}
function windowManager()
{var topWin=getTopmostWindow(window);if(!topWin.windowManagerStore)
{topWin.windowManagerStore=new windowManagerStore();}
this.windowManagerStore=topWin.windowManagerStore;}
function windowManager_Add(strName,obj)
{this.windowManagerStore['window'+strName]=obj;}
windowManager.prototype.Add=windowManager_Add;function windowManager_Exists(strName)
{try{if(this.windowManagerStore['window'+strName]&&this.windowManagerStore['window'+strName].self)
return true;return false;}
catch(er){};return false;}
windowManager.prototype.Exists=windowManager_Exists;function windowManager_Get(strName)
{return this.windowManagerStore['window'+strName];}
windowManager.prototype.Get=windowManager_Get;function windowManagerStore()
{}
function getTopmostWindow(win)
{while((win.parent!=null)&&(win.parent!=win))
{win=win.parent;}
return win;}
function KillEnterAndJump()
{if(window.event.keyCode==13)
{window.event.keyCode=0;goToAnchor();}}
function ToggleDivVis(whichDiv,imageRef){var OpenMenuSrc="/skins/BIW/images/menuimages/menu/win/plusonlyraw.gif";var CloseMenuSrc="/skins/BIW/images/menuimages/menu/win/minusonlyraw.gif";imageActual=eval('document.'+imageRef);theDiv=eval(whichDiv);if(theDiv.style.display=='block'){theDiv.style.display='none';imageActual.src=OpenMenuSrc;}
else{theDiv.style.display='block';imageActual.src=CloseMenuSrc;}}
function setToggleV()
{for(var i=0,n=$('.progress_outer').length;i<n;++i){$('.progress_outer')[i].style.display='block';}
$('.progress_outer').show();}
function C1ToggleAll(id,open,level)
{var table=document.getElementById(id);if(table==null)return;var rows=table.getElementsByTagName("tr");var count=0;var style=open?"":"none";var nodeLevel=NaN;var imgSrc=open?"/BIW/Core/JSLibrary/C1WebGrid/minus.gif":"/BIW/Core/JSLibrary/C1WebGrid/plus.gif";var toggle=false;var imgToggle;for(var i=0;i<rows.length;i++)
{var row=rows[i];var isHeading=row.id.indexOf(id+"_GH")>-1;var isRow=row.id.indexOf(id+"_R")>-1;var showLevel;if(isHeading)
{toggle=false;nodeLevel=parseInt(row.getAttribute("nodeLevel"));if(level==-1||(open&&(nodeLevel<level+1))||!open)
{var img=row.getElementsByTagName("td")[0].getElementsByTagName("img")[0];imgToggle=img.src;img.src=imgSrc;}}
if(open&&isHeading)
{if(imgToggle.indexOf('plus.gif')>0)
toggle=true;}
if(open)
{showLevel=level==-1||(isRow&&nodeLevel<=level)||(isHeading&&nodeLevel<=level+1);}
else
{showLevel=(!isNaN(nodeLevel)&&nodeLevel>1)||isRow;}
if(!isNaN(nodeLevel)&&(isHeading||isRow)&&showLevel)
{if(open&&toggle)
{c1g_toggleRowVisisbility(row,'');}
row.style.display=style;}}}
function C1OpenFirstGroup(id)
{var table=document.getElementById(id);if(table==null)return;var rows=table.getElementsByTagName("tr");var headingCount=0;for(var i=0;i<rows.length;i++)
{var row=rows[i];var isHeading=row.id.indexOf(id+"_GH")>-1;var isRow=row.id.indexOf(id+"_R")>-1;if(isHeading)
{headingCount=headingCount+1;if(headingCount==2){break;}
var img=row.getElementsByTagName("td")[0].getElementsByTagName("img")[0];img.src="/BIW/Core/JSLibrary/C1WebGrid/minus.gif";}
if(isRow){row.style.display="";}}}
function SortListItemFuncAsc(record1,record2){var value1=record1.optText.toLowerCase();var value2=record2.optText.toLowerCase();if(value1>value2)return(1);if(value1<value2)return(-1);return(0);}
function SortListItemFuncDesc(record1,record2)
{return SortListItemFuncAsc(record2,record1);}
function SortListItems(selectToSort,useAscending)
{if(useAscending==null)
useAscending=true;var myOptions=[];for(var loop=0;loop<selectToSort.options.length;loop++)
{myOptions[loop]={optText:selectToSort.options[loop].text,optValue:selectToSort.options[loop].value};}
if(useAscending)
{myOptions.sort(SortListItemFuncAsc);}
else
{myOptions.sort(SortListItemFuncDesc);}
selectToSort.options.length=0;for(var loop=0;loop<myOptions.length;loop++)
{selectToSort.options[loop]=new Option(myOptions[loop].optText,myOptions[loop].optValue);}}
function SelectListItems(list)
{for(var i=0;i<list.options.length;i++)
{list.options[i].selected=true;}}
function CheckTime(time,validationControl)
{var bflag=false;if(time!=null&&time!="")
{var validTimeFormat=/^\d{2}\:\d{2}$/;if(!validTimeFormat.test(time))
validationControl.errormessage="Invalid Time Format. Please correct and submit again.";else
{var hourfield=time.split(":")[0];var minfield=time.split(":")[1];if((hourfield>23||hourfield<0)||(minfield>59||minfield<0))
validationControl.errormessage="Invalid time detected. Please correct and submit again.";else
bflag=true;}}
return bflag}
function UpdateRestrictionLabel(textObj,maxCharacters,label)
{var objLabel=$("#"+label);var x=maxCharacters-$(textObj).val().length;if(x<0)x=0;objLabel.text(x+" Characters left");}
function LimitText(textObj,maxCharacters)
{if(textObj.innerText.length>=maxCharacters){textObj.innerText=textObj.innerText.substring(0,maxCharacters);if((event.keyCode>=32&&event.keyCode<=126)||(event.keyCode>=128&&event.keyCode<=254)){event.returnValue=false;}}}
function GridViewChildToggle(obj,img)
{if(obj.style.display=="none")
{obj.style.display="";img.src="/BIW/Core/JSLibrary/C1WebCommand/af_ind_up_light.gif";img.alt="Collapse";}
else
{obj.style.display="none";img.src="/BIW/Core/JSLibrary/C1WebCommand/af_ind_down_light.gif";img.alt="Expand";}}
function selectAll(controlId,checkBoxId)
{var i=0;var check=false;if($get(checkBoxId)!=null)
{if($get(checkBoxId).checked)
check=true;var checkBoxList=$get(controlId).getElementsByTagName('input');for(i=0;i<checkBoxList.length;i++)
checkBoxList[i].checked=check;}}
function SelectAllCheckBoxes(checkBoxID,controlID,columnIndex)
{var check=false;if($get(checkBoxID.id)!=null)
{if($get(checkBoxID.id).checked)
check=true;}
for(i=1;i<$get(controlID.id).rows.length;i++)
{var checkBox=$get(controlID.id).rows[i].cells[columnIndex].getElementsByTagName('input');if(checkBox.length>0)
{if(checkBox[0].type=="checkbox")
checkBox[0].checked=check;}}}
var DELAY=1200;var i=0;var pendingFunc;var pendingFuncID;function FormatCurrencyValue(Id,myFunction)
{ChangeValue(Id,myFunction);}
function ChangeValue(Id,myFunction)
{i++;var v=i;pendingFunc=function(){ChangeValueDelayed(v,Id,myFunction)};pendingFuncID=setTimeout(pendingFunc,DELAY);}
function ChangeValueDelayed(x,Id,myFunction)
{if(i==x)
{pendingFunc=null;if(Id!=null)
myFunction(Id);else
myFunction();}}
function FormatCurrencyById(id)
{$('#'+id).val(AddThousandSepPrecision($('#'+id).val()));}
function FormatCurrencyByValue(val)
{return AddThousandSepPrecision(val);}
function CloseParentThickbox()
{self.parent.tb_remove();}
function ReloadParentFromThickbox()
{self.parent.document.location=self.parent.document.location;}
function GetFilename(url)
{if(url)
{var m=url.toString().match(/.*\/(.+?)\./);if(m&&m.length>1)
{return m[1];}}
return"";}
function GetFilenameWithExtension(url)
{if(url)
{var m=url.toString().match(/.*\/(.*)$/);if(m&&m.length>1)
{return m[1];}}
return"";}