//Globalsvar url=window.document.URL.toLowerCase();url=url.substring(0,url.indexOf('.nsf')+4);var agt=navigator.userAgent.toLowerCase(); var isIE=(agt.indexOf("msie") != -1 && parseInt(navigator.appVersion)>5); function openStaticWindow(fileName,windowName,theWidth,theHeight,x,y){var x1=x||20;var y1=y||20;var mywin=window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,left="+x1+",top="+y1+",width="+theWidth+",height="+theHeight);mywin.focus();if (!mywin.opener)mywin.opener = self;}function valid(o,w){var r={  'special':/[\W]/g,  'quotes':/['\''&'\"']/g,  'notnumbers':/[^\d]/g,  'numeric':/[^0-9$.%]/g,  'ssnum':/[^0-9-]/g};o.value = o.value.replace(r[w],'');}function checkAll(fieldName,ck){$("input[id="+fieldName+"]").each(function(){ this.checked=ck.checked;});}function getPage(doc){parent.frames['data'].location.href=url+"/"+doc;}function showStatus(text){window.status=text;}function cName(obj, new_style){obj.className = new_style;}function openDialog(fileName,windowName,theWidth,theHeight,x,y){var x1=x||10;var y1=y||10;var mywin=window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left="+x1+",top="+y1+",width="+theWidth+",height="+theHeight);mywin.focus();if (!mywin.opener)mywin.opener = self;return false;}function openSimpleWindow(fileName,windowName,theWidth,theHeight){var mywin=window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=30,top=20,width="+theWidth+",height="+theHeight);mywin.focus();if (!mywin.opener)mywin.opener = self;}function openWindow(fileName,windowName,theWidth,theHeight){window.open(fileName,windowName,"toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,left=50,top=20,width="+theWidth+",height="+theHeight);}function newAppointment(myurl,myDate,myClient){if (myurl=='') {myurl=url}var rnd=Math.floor(Math.random()*99999);openStaticWindow(url+"/appointment?openForm&popup=true&client="+myClient+"&date="+myDate,"appt"+rnd,820,600);}function newContact(){openStaticWindow(url+"/person?openForm","person",630,400);}function newPackage(){openStaticWindow(url+"/package?openForm","package",610,370);}function newAddon(){openStaticWindow(url+"/addon?openForm","package",570,320);}function htmlEditor(){openStaticWindow(url+"/htmlEditor?openpage","editor",780,500);}function newInfo(doc){openStaticWindow(url+"/"+doc+"?openpage","help",530,430);}function newMemo(sendTo){openStaticWindow(url+"/memo?openForm&send="+sendTo,"memo",640,480);}function oew(){window.open("","eW","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=20,top=20,width=900,height=700");}function newBlackout(){openStaticWindow(url+"/blackout?openForm","eB",850,360);}function selectAll(docField){for (counter=0;counter<docField.length;counter++){if (docField[counter].checked==0){docField[counter].checked=1;}else{docField[counter].checked=0;}}}function checkit(doc){var count=0;for (counter=0;counter<doc.noteids.length;counter++){if (doc.noteids[counter].checked) {count++}}if (count==0){alert ('Cannot continue since nothing was selected.');return false;}doc.action.value="Remove Selected";if (confirm('Process the following '+count+' document(s)')){doc.submit();}return false;}function removeDB(){openStaticWindow(url+"/removeDB?openForm","memo",400,400);}function newSubImport(){openStaticWindow(url+"/dbImport?openForm","memo",370,530);}function newCDDBImport(){openStaticWindow("http://www.gigbuilder.com/cddb.nsf/music.html","cddb",750,530);}function newImport(){openStaticWindow(url+"/Upload?openForm","memo",600,400);}function newExport(){openStaticWindow(url+"/musicexport?openPage","memo",600,400);}function newExportCal(){openStaticWindow(url+"/exportdata?openForm","memo",400,320);}function daysInMonth(aDate){var m = new Number(aDate.getMonth());var y = new Number(aDate.getYear());var tmpDate = new Date(y, m, 28);var checkMonth = tmpDate.getMonth();var lastDay = 27;while(lastDay <= 31){temp = tmpDate.setDate(lastDay + 1);if(checkMonth != tmpDate.getMonth())break;lastDay++;}return lastDay;}function doIt(docid,theWidth,theHeight){openStaticWindow(docid+"?open","childWindow",theWidth,theHeight);}function newSubKImport(){openStaticWindow(url+"/dbkImport?openForm","memo",350,530);}function newCategory(){openStaticWindow(url+"/addcat?openForm","category",300,100,250,55);}function editCategory(x){openStaticWindow(url+"/addcat?openForm","category",300,100,250,55);}function newExpense(){openStaticWindow(url+"/expense?openForm","expense",700,300);}function newPost(){openStaticWindow(url+"/post?openForm","memo",500,250);};Date.prototype.adjust = function(yr,mn,dy,hr,mi,se) {var m,t;this.setYear(this.getFullYear() + yr);m = this.getMonth() + mn;if(m != 0) this.setYear(this.getFullYear() + Math.floor(m/12));if(m < 0) {this.setMonth(11 + (m%12)); } else if(m > 0) {this.setMonth(m%12);}t = this.getTime();t += (dy * 86400000);t += (hr * 3600000);t += (mi * 60000);t += (se * 1000);this.setTime(t);} function showDate(z){var d=z.getDate();var m=z.getMonth()+1; var md=m.toString()+"/"+d.toString()+"/"+z.getFullYear().toString();return md;}function valid(o,w){var r={'special':/[\W]/g,'quotes':/['\''&'\"']/g,'notnumbers':/[^\d]/g,'numeric':/[^0-9$.%]/g};o.value = o.value.replace(r[w],'');}function formatUSphone(num){var returnval=num;var re = /[^0123456789]/gi;var numCleaned=num.replace(re,'');if(numCleaned.length!= 10)  {returnval=num;  } else {returnval = '('+numCleaned.substring(0,3)+') '+numCleaned.substring(3,6)+'-'+numCleaned.substring(6,10);  }  return returnval; }function openById(docid,windowName,theWidth,theHeight) {var myurl=url+'/alldocs/'+docid+'?open&popup=true';var win=window.open(myurl,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=10,top=10,width="+theWidth+",height="+theHeight);win.window.resizeTo(theWidth,theHeight);}function editById(docid,windowName,theWidth,theHeight,reload) {if (reload==true){rld="true"}else{rld=false};var myurl=url+'/alldocs/'+docid+'?edit&popup=true&reload='+rld;var win=window.open(myurl,windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=10,top=10,width="+theWidth+",height="+theHeight);win.window.resizeTo(theWidth,theHeight);}function newTask(){openStaticWindow(url+"/Task?openForm","task",400,380);}function linkById(docid,frame){parent.frames[frame].location.href=url+"/alldocs/"+docid+"?open";}function getHelp(id){openSimpleWindow("http://www.wedjsupport.com/questions/"+id,"help",1024,600);}function readCookie(name) {	var nameEQ = name + "=";	var ca = document.cookie.split(';');	for(var i=0;i < ca.length;i++) {		var c = ca[i];		while (c.charAt(0)==' ') c = c.substring(1,c.length);		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);	}	return null;}function removeDocs(id){var t;t="0";$('#'+id+':checked').each(function() { t=t+"-"+$(this).val();}); if (t.length<32){alert('You must select at least one item to delete.');return false;}$.get(url+"/gbxml?open", { cmd: "removeDocument", uid:t},function(data){alert(data);window.location.reload();});}function eraseCookie(name){setCookie(name,"",-1);}function setCookie(name,value,days) {	if (days) {		var date = new Date();		date.setTime(date.getTime()+(days*24*60*60*1000));		var expires = "; expires="+date.toGMTString();	}	else var expires = "";	document.cookie = name+"="+value+expires+"; path=/";}function Left(str, n){if (n <= 0){return ""}else if (n > String(str).length){return str}else{return String(str).substring(0,n);}}function Right(str, n){    if (n <= 0)       return "";    else if (n > String(str).length)       return str;    else {       var iLen = String(str).length;       return String(str).substring(iLen, iLen - n);    }}
