// Minit Design Global JavaScript Functions

// Function to set initial value of textbox
<!-- Begin
function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}
//  End -->

// Begin function for antispam email address
<!-- Begin
var user;
var domain;
var suffix;

function minitdesign_email_address(user, domain, suffix){

document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + user + '@' + domain + '.' + suffix + '</a>');
}
//  End -->

<!-- //Function to open browser window to view chat room
function chat() {
	msg=window.open("chat/default.asp","","height=540,width=780,left=0,top=0");
	}
	//-->

function Print(url)
	{
	newWindow = window.open(url,'','resize=true,width=600,height=600,left=0,top=0,menubar=0,location=0,toolbar=0,scrollbars=1');
	}
	
<!--// Function for jump menu
function gotoURL(theSelect) {
thehref = theSelect.options[theSelect.selectedIndex].value;
window.location.href = thehref;
}
// -->

<!--// Function for jump menu
function ChangeStyle(theSelect) {
thehref = theSelect.options[theSelect.selectedIndex].value;
window.location.href = thehref;
}
// -->

<!--// Function for jump menu
function ChangePageSize(theSelect) {
thehref = theSelect.options[theSelect.selectedIndex].value;
window.location.href = thehref;
}
// -->

// killErrors
function tmtC_stopErrors() {
return true;}
window.onerror = tmtC_stopErrors;
//killErrorsEnd

function hideshow(which,img,imgsrc){
	var now = new Date();
	now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 365)
	if(document.all && !document.getElementById) {
		document.getElementById = function(id) {
			 return document.all[id];
		}
	}
	if (document.getElementById){
		oWhich = document.getElementById(which).style;
		oImage = document.getElementById(img );}
	else
		if (document.layers) {
			oWhich = document.layers[which];
			oImage = document.layers[img];}
	window.focus();
	
	if (oWhich.display == "none"){
		oWhich.display = "";
		oImage.src = imgsrc + "/hide_min.gif"
		oImage.alt = "Hide";
		setCookie(which,"show","/",now);
		}
	else{
		oWhich.display = "none";
		oImage.src = imgsrc + "/hide_max.gif";
		oImage.alt = "Show";
		setCookie(which,"hide","/",now);
		}
}

function setCookie(name, value, path, expires, domain, secure){
	 document.cookie = name + "=" +escape(value) +
        ((expires) ? ";expires=" + expires.toGMTString() : "") +
        ((path) ? ";path=" + path : "") + 
        ((domain) ? ";domain=" + domain : "") +
        ((secure) ? ";secure" : "");	
		
}
function getCookie1(name){
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1){
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;}
    else{
        begin += 2;}
    var end = document.cookie.indexOf(";", begin);
    if (end == -1){
        end = dc.length;}
    return unescape(dc.substring(begin + prefix.length, end));
}

function getCookie(name) {
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
}

function deleteCookie(name, path, domain){
    if (getCookie(name)){
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";}
}
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}
function trimAll( strValue ) {
	var objRegExp = /^(\s*)$/;
	if(objRegExp.test(strValue)) {
		strValue = strValue.replace(objRegExp, '');
		if( strValue.length == 0)
			return strValue;
		}
	objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
	if(objRegExp.test(strValue)) {
		strValue = strValue.replace(objRegExp, '$2');
	}
	return strValue;
}

// Function to bust frames
<!--
if (window!= top)
top.location.href=location.href
// -->

// Function to check delete members
function checkdelete(obj) 
{
	var checkboxChecked = false;
	var radioChecked = false;
	
	for (var i=0; i<obj.elements.length;i++)
	{
	var currentElement = obj.elements[i];
	var currentType = currentElement.type;
	
	if (currentType == 'checkbox' && currentElement.checked)
	{
	checkboxChecked = true;
	}
	if (currentType == 'radio' && currentElement.checked)
	{
	radioChecked = true;
	}
	}
if (!checkboxChecked)
{
	alert('You must select at least one (1) record to delete.');
	return false;
	}
	return true;
	}

// Function to check all check boxes
function checkall(formname,checkname,thestate){
var el_collection=eval("document.forms."+formname+"."+checkname)
for (c=0;c<el_collection.length;c++)
el_collection[c].checked=thestate
}

<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

<!-- //reloads the window if Nav4 resized
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->

// Clock Script 
function tS(){ x=new Date(); x.setTime(x.getTime()); return x; } 
function lZ(x){ return (x>9)?x:'0'+x; } 
function tH(x){ if(x==0){ x=12; } return (x>12)?x-=12:x; } 
function y2(x){ x=(x<500)?x+1900:x; return String(x).substring(2,4) } 
function dT(){ if(fr==0){ fr=1; document.write('<font size=1 face=tahoma color=#999999><b><span id="tP">'+eval(oT)+'</span></b></font>'); } tP.innerText=eval(oT); setTimeout('dT()',1000); } 
function aP(x){ return (x>11)?'pm':'am'; } 
var dN=new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'),mN=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'),fr=0,oT="dN[tS().getDay()]+' '+tS().getDate()+' '+mN[tS().getMonth()]+' '+y2(tS().getYear())+' '+''+' '+tH(tS().getHours())+':'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())+' '+aP(tS().getHours())";

// Function to show/Hide help popups
function ShowHelp(div, title, desc)
{
	div.style.display = 'inline';
	div.style.position = 'absolute';
	div.style.width = '160';
	div.style.backgroundColor = 'lightyellow';
	div.style.border = 'dashed 1px black';
	div.style.padding = '2px';
	div.innerHTML = '<b class="smallgreybold">&nbsp;' + title + '</b><br /><img src=images/spacer.gif width=1 height=5><br /><div style="padding-left:5; padding-right:2" class="smallgrey">' + desc + '</div>';
}

function HideHelp(div)
{
	div.style.display = 'none';
}

<!--
   var yyDatevar ='YYnull';
   var yyDiv=null;var YYLang='de';
   var dom= new Array(12);
   dom[0]=31;dom[1]=28;dom[2]=31;dom[3]=30;dom[4]=31;dom[5]=30;dom[6]=31;dom[7]=31;dom[8]=30;dom[9]=31;dom[10]=30;dom[11]=31;
   var YYstrm= new Array(12);
   YYstrm[0]='January';YYstrm[1]='February';YYstrm[2]='March';YYstrm[3]='April';YYstrm[4]='May';YYstrm[5]='June';YYstrm[6]='July';
   YYstrm[7]='August'; YYstrm[8]='September';YYstrm[9]='October';YYstrm[10]='November';YYstrm[11]='December';
   //-->
   
// Function to expand/contract textfields
function expand(obj){
	obj.style.width = "250px";
	}

function collapse(obj){
	obj.style.width = "";
	}