
// JavaScript Document

function P7_setCSS(d, theStyle) { //v1.8 by PVII
  var expDays=parseInt(d),path = "/";
  var expdate = new Date();
  expdate.setTime(expdate.getTime() + (expDays*24*60*60*1000));
  document.cookie = "p7styler=" + escape (theStyle) + "; expires=" + expdate.toGMTString() +'; path=' + path;
 // top.location.reload();
}




function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

var newWin = null; 

function popUp(strURL, strType, strHeight, strWidth, winAlign) { 
 var winAlign, leftPos=0,topPos=0, w = 0, h = 0;  
 winAlign =  winAlign.length > 0 ?  winAlign : 'top';
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="console") 
   strOptions="resizable,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixed") 
   strOptions="status,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="elastic") 
   strOptions="toolbar,menubar,scrollbars,"+ 
     "resizable,location,height="+ 
     strHeight+",width="+strWidth; 

 if (document.all || document.layers || document.getElementById) {
              w = screen.availWidth; h = screen.availHeight;
 }
		if (winAlign.indexOf("center") != -1) {
         topPos = (h-strHeight)/2;leftPos = (w-strWidth)/2;
        }
		if (winAlign.indexOf("bottom") != -1) topPos = h-strHeight;
        if (winAlign.indexOf("right") != -1) leftPos = w-strWidth; 
		if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0; 	
 strOptions += (strOptions.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;					
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}



function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4
if(imageName=='')
return false;
        if (bgcolor=="") {
                bgcolor="#FFFFFF";
        }
        var adj=10
        var w = screen.width;
        var h = screen.height;
        var byFactor=1;

        if(w<740){
          var lift=0.90;
        }
        if(w>=740 & w<835){
          var lift=0.91;
        }
        if(w>=835){
          var lift=0.93;
        }
        if (imageWidth>w){
          byFactor = w / imageWidth;
          imageWidth = w;
          imageHeight = imageHeight * byFactor;
        }
        if (imageHeight>h-adj){
          byFactor = h / imageHeight;
          imageWidth = (imageWidth * byFactor);
          imageHeight = h;
        }

        var scrWidth = w-adj;
        var scrHeight = (h*lift)-adj;

        if (imageHeight>scrHeight){
            imageHeight=imageHeight*lift;
          imageWidth=imageWidth*lift;
        }

        var posLeft=0;
        var posTop=0;

        if (hugger == "hug image"){
          if (hugMargin == ""){
            hugMargin = 0;
          }
          var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
          if (scrHeightTemp < scrHeight) {
                scrHeight = scrHeightTemp;
          }
          var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
          if (scrWidthTemp < scrWidth) {
                scrWidth = scrWidthTemp;
          }

          if (scrHeight<100){scrHeight=100;}
          if (scrWidth<100){scrWidth=100;}

          posTop =  ((h-(scrHeight/lift)-adj)/2);
          posLeft = ((w-(scrWidth)-adj)/2);
         }

        if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
                imageHeight=imageHeight-adj;
                imageWidth=imageWidth-adj;
        }
        posTop = parseInt(posTop);
        posLeft = parseInt(posLeft);
        scrWidth = parseInt(scrWidth);
        scrHeight = parseInt(scrHeight);

        var agt=navigator.userAgent.toLowerCase();
        if (agt.indexOf("opera") != -1){
          var args= new Array();
          args[0]='parent';
          args[1]=imageName;
          var i ; document.MM_returnValue = false;
          for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
        } else {
          
        newWindow = window.open("picture.html","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
        newWindow.document.open();
// onBlur="self.close()" onClick="self.close()"
        BaseUrl = document.location.protocol + '//' + document.location.host + '/' ;

        newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+'>');
        newWindow.document.write('<table width='+BaseUrl +imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
        newWindow.document.write('<img src="'+BaseUrl+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="" >');
        newWindow.document.write('</td></tr></table></body></html>');
        newWindow.document.close();
        newWindow.focus();
        }
}
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function changeFrame(frame,link){
        top.frames[frame].location=link;
        }
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function annotate() {
	now = new Date;
	var month = now.getMonth() + 1;
	if (month < 10) { 
		month = "0" + month;
	}
	if (now.getDate() < 10) { 
		var day = "0" + now.getDate();
	}
	else {
		var day = now.getDate();
	}
	if (now.getMinutes() < 10) { 
		var minutes = "0" + now.getMinutes();
	}
	else {
		var minutes = now.getMinutes();
	}
	if (now.getHours() < 10) { 
		var hours = "0" + now.getHours();
	}
	else {
		var hours = now.getHours();
	}
	var add = "-----  " + month + "-" + day + "-" + now.getFullYear() + " @ " + hours + ":" + minutes + 
	          " \n\n";
	document.update_clients_form.comments.value = add + document.update_clients_form.comments.value;
}
function GP_popupConfirmMsg(msg) { //v1.0
  document.MM_returnValue = confirm(msg);
}
// mouseover  function
// param imgName   string  image name/id  
//param imgSrc  string image url
//Example: changeImages('img1','dsg/img_y.gif')
function changeImages(imgName, imgSrc) 
{
 var imgName;
 var imgSrc;
  if (document.images)
  {
    if (imgSrc != "none")
    {
  if ( document.images[imgName])
      document.images[imgName].src = imgSrc;
    }
  }
}

// Example:
// preload( '01.gif', '02.gif' ); 
function preload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

//function to open popup window
//Example: 
//<a href="link.html" onClick="PopupLink('windowName','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=100,height=200');return document.MM_returnValue">bla</a>
function PopupLink(winName,features) { 	
  	window.open(this.href,winName,features); document.MM_returnValue = false;
}


// advanced function for pop up window, one can define  (url, window name, features, window  width, window height, window align, if  link to be ignored, if window to be on top, auto close time in sec, if it is bordless)
// param theURL - string  e.g "new_pop_up.html'  
//param winName string containing only  alfanumeric characters
// param features : 
                   //fullscreen=yes/no, 
                  //toolbar=yes/no,
				  //location=yes/no,
				  //status=yes/no,
				  //menubar=yes/no,
				  //scrollbars=yes/no,
				  //resizable=yes/no
//param popWidth integer
//param  popHeight integer
//param  winAlign  string: 
               //  pls choose :  'lefttop' / 'leftcenter '/ l'eftbottom' / 'righttop '/ r'ightcenter '/ 'rightbottom' / 'topcenter' / 'center '/ 'bottomcenter'
				  
//param ignorelink  string :
           // 'ignoreLink' if you wish to ignore current link and '' if not to
//param  alwaysOnTop  string
                // 'alwaysOnTop' if you wish the window to be  on top of all others windows and '' if not to		
//param  autoCloseTime integer 
// param  borderless  string :
			     // 'borderless' if you wish the window to be   borderless and '' if not to	 
				   				  
//example  onclick="GP_AdvOpenWindow('url.html','name','fullscreen=no,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes',100,100,'lefttop','ignoreLink','alwaysOnTop',0,'');return document.MM_returnValue" 
function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
  var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
    if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
		if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
		if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth; 
		if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0; 						
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  if (window["popupWindow"] == null) window["popupWindow"] = new Array();
  var wp = popupWindow.length;
  popupWindow[wp] = window.open(theURL,winName,features);
  if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;  
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
    	ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
    	popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
    	popupWindow[wp].document.body.onbeforeunload = function() {
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
  	window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }   
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}

//SNIPPETS:


//1.close window:
//<a href="javascript:window.close();">Close</a>

//2.Go back
//<a href="javascript:history.go(-1);">Go back</a>


//3.Adv. email link
//<a href="mailto:to@email.com?Subject=Subject&CC=cc@email.com&BCC=bcc@email.com&Body=Body gre tukaj .... ">email</a>

var marked_row = new Array;
/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   interger  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == '' || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function

      if (supportsDynamicLabels()) {
        document.writeln('<style type="text/css">');
        document.writeln('label.dynamic { display:none; }');
        document.writeln('</style>');

        addEvent(window, "load", setupLabels);
      }

      function setupLabels() {
        var objLabels = document.getElementsByTagName("LABEL");
        var objField;

        for (var i = 0; i < objLabels.length; i++) {
          if ("dynamic" == objLabels[i].className) {
            objField = document.getElementById(objLabels[i].htmlFor);
            addEvent(objField, "focus", focusDynamicLabel);
            addEvent(objField, "blur", blurDynamicLabel);
            objField._labelText = objLabels[i].firstChild.nodeValue;
            objField.value = objField._labelText;
          }
        }

        for (var i = 0; i < document.forms.length; i++) {
          addEvent(document.forms[i], "submit", resetLabels);
        }
      }

      function resetLabels(event) {
        var elm = getEventSrc(event);
        var objLabels = elm.getElementsByTagName("LABEL");
        var objField;


        for (var i = 0; i < objLabels.length; i++) {
          if ("dynamic" == objLabels[i].className) {
            objField = document.getElementById(objLabels[i].htmlFor);
            if (objField._labelText == objField.value) {
              objField.value = "";
            }
          }
        }
      }

      function addEvent(objObject, strEventName, fnHandler) {
        if (objObject.addEventListener)
          objObject.addEventListener(strEventName, fnHandler, false);
        else if (objObject.attachEvent)
          objObject.attachEvent("on" + strEventName, fnHandler);
      }

      function focusDynamicLabel(event) {
        var elm = getEventSrc(event);
        if (elm._labelText == elm.value) {
          elm.value = "";
        }
      }

      function blurDynamicLabel(event) {
        var elm = getEventSrc(event);
        if ("" == elm.value) {
          elm.value = elm._labelText;
        }
      }

      function getEventSrc(e) {
        if (!e) e = window.event;

        if (e.originalTarget)
          return e.originalTarget;
        else if (e.srcElement)
          return e.srcElement;
      }

    function supportsDynamicLabels() {
      return document.getElementById && 
        (window.attachEvent || window.addEventListener) && 
        null == navigator.appVersion.match(/Safari\/\d+$/);
    }



function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) +
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}

// An adapxation of Dorcht's function for deleting a cookie.
function delCookie (name,path,domain) {
  if (readCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function delAllCookie() {
if (document.cookie != "")
    {
        var cookieInfo, cookieData;
        var expireDate = new Date();
       // if (confirm("Are you sure you want to delete the cookies?"))
        //{
            cookieInfo = document.cookie.split("; ");
            // Set the expiration date to yesterday
            expireDate.setDate(expireDate.getDate() - 1);
            for (counter=0; counter<cookieInfo.length; counter++)
            {
                // Get the cookie name
                cookieData = cookieInfo[counter].split("=")[0];
                // Add a null value and the expiration date
                cookieData += "=;expires=" + expireDate.toGMTString();
                // Expire the cookie
                document.cookie = cookieData; 
           // }
        }
    }
  }   
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
 
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}
function check(someArray, someValue) {
 for (var j = 0; j < someArray.length; j++) {  
      if (someArray[j] == someValue.toLowerCase() ) 
	 //alert(someArray[j]+ someValue.toLowerCase());
	     return true; 
     } return false; 
 }
  
function increase(fontIncrease, orig){ 
var currentElement, currentFontSize, newFontSize, orig;  

if (document.getElementsByTagName)  
   {  
      tags1 =   new Array ('div','h2' ,'p', 'a','span','td', "ul");  
      tags2 =  new Array ('h1');
	  tags = tags1.concat(tags2);
      for (j = 0; j < tags.length; j ++)  
      {  

        var tagElements = document.getElementById('maintextcontainer').getElementsByTagName(tags[j]);  
        
         for (i = 0; i < tagElements.length; i ++)  
         {  
            currentElement = tagElements[i]; 
		
            if(check(tags2,currentElement.tagName)){				
		    if (parseInt(orig)) currentFontSize = (parseInt(11))+ 'px'; 
		else{
			   if(parseInt(readCookie(currentElement.tagName))>0){ 			    
			    currentFontSize=(parseInt(readCookie(currentElement.tagName))) + 'px';			 
			   } else{
			   if(parseInt(currentElement.style.fontSize)>0)
			   currentFontSize = parseInt(currentElement.style.fontSize); 
			   else
			    currentFontSize = (parseInt(11))+ 'px'; 
			  }
			 } 
			 
			}else{
             // currentFontSize = parseInt(currentElement.style.fontSize); 
              if (parseInt(orig)) currentFontSize = (parseInt(11)); 
		else{
  //  alert(parseInt(fontIncrease));
if(parseInt(readCookie(currentElement.tagName))>0 && parseInt(fontIncrease)==0 ){ 
			
				currentFontSize=(parseInt(readCookie(currentElement.tagName))) + 'px';			
				} else{
			    if(parseInt(currentElement.style.fontSize)>0)
			     currentFontSize = parseInt(currentElement.style.fontSize); 
			   else
			    currentFontSize = (parseInt(11))+ 'px'; 
				}
			}
if ( parseInt(currentFontSize)<=11 && parseInt(fontIncrease)!=0){
fontIncrease ="+3";
changeImages('fontTool', 'dsg/toolbar_07_minus.gif') ;
}
if ( parseInt(currentFontSize)>=14 && parseInt(fontIncrease)!=0){
 fontIncrease ="-3";  
 changeImages('fontTool', 'dsg/toolbar_07.gif') ;
 }
			 }
if ( parseInt(readCookie(currentElement.tagName))<=11){
changeImages('fontTool', 'dsg/toolbar_07.gif') ;
}
if ( parseInt(readCookie(currentElement.tagName))>=14){
 changeImages('fontTool', 'dsg/toolbar_07_minus.gif') ;
 }			 
//alert(currentFontSize);
//   alert(currentFontSize);      
   
            newFontSize = parseInt(currentFontSize) + parseInt(fontIncrease); // alert(newFontSize); 
			//alert(parseInt(currentElement.style.fontSize));
          if (!parseInt(currentElement.style.fontSize)) currentElement.style.fontSize ='11px'; 
 if (parseInt(currentElement.style.fontSize)>11 && parseInt(fontIncrease)==parseInt('-3') ) {
            currentElement.style.fontSize = newFontSize + 'px'; 
		    setCookie(currentElement.tagName, newFontSize);  
}
 if (parseInt(currentElement.style.fontSize)<15 && parseInt(fontIncrease)==parseInt('3') ) {
            currentElement.style.fontSize = newFontSize + 'px'; 
		    setCookie(currentElement.tagName, newFontSize);  
}
if(parseInt(fontIncrease)==0) {
currentElement.style.fontSize = newFontSize + 'px'; 
		    setCookie(currentElement.tagName, newFontSize);  
}
         }  
      } 
       
   } 
 }  
 
 
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  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);


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_jumpMenuGo(selName,targ,restore){ //v3.0

  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}


function P7_JumpMenu(selObj,restore){ //v1.4 by Project Seven
	var theFullString = selObj.options[selObj.selectedIndex].value;
	if (restore) selObj.selectedIndex=0;
	var theLength = theFullString.length;
	var endPos = theFullString.lastIndexOf("~");
	var theUrl, theTarget, theParent;
	if (endPos > 0) {theUrl = theFullString.substring(0,endPos);}
	else {theUrl = theFullString;}
	endPos++
	if (endPos < theLength) {theTarget = theFullString.substring(endPos,theLength)}
	else {theTarget = "window:Main";}
	if (theTarget == "window:New") {window.open(theUrl);}
	else if (theTarget == "window:Main") {eval("parent.location='"+theUrl+"'");}
	else {eval("parent.frames[\'"+theTarget+"\'].location='"+theUrl+"'");}
}

//
//
//	CURRENCY NUMBER FORMATTING
//
//	START

function GetDecimalDelimiter(nCountryCode)
{

	var sRet='';

	switch (nCountryCode)
	{

		case 3:
			sRet = '#';
			break;

		case 2:
			sRet = ',';
			break;

		default:
			sRet = '.';
			break;

	}

	return sRet;

}

function GetCommaDelimiter(nCountryCode)
{

	var sRet='';
	
	switch (nCountryCode)
	{

		case 3:
			sRet = '*';
			break;

		case 2:
			sRet = '.';
			break;

		default:
			sRet = ',';
			break;

	}

	return sRet;

}

function FormatClean(num)
{

	var sVal='';
	var nVal = num.length;
	var sChar='';

	try
	{
		for(i=0;i<nVal;i++)
		{
			sChar = num.charAt(i);
			nChar = sChar.charCodeAt(0);
			if ((nChar >=48) && (nChar <=57))  { sVal += num.charAt(i);	}
		}
	}

	catch (exception) { AlertError("Format Clean",e); }
	return sVal;

}


function FormatCurrency(num,nCountryCode)
{

	var sVal='';
	var minus='';
	var Decimal='';
	Decimal = GetDecimalDelimiter(nCountryCode);
	if (num.lastIndexOf("-") == 0) { minus='-'; }
	if (num.lastIndexOf(Decimal) < 0) { num = num + '00'; }
	num = FormatClean(num);
	sVal = minus + FormatDollar(num,GetCommaDelimiter(nCountryCode)) + GetDecimalDelimiter(nCountryCode) + FormatCents(num);
	return sVal;

}

function FormatNumber(num,nCountryCode)
{

	var sVal='';
	var minus='';
	var CommaDelimiter='';

	try
	{

		CommaDelimiter = GetCommaDelimiter(nCountryCode);

		if (num.lastIndexOf("-") == 0) { minus='-'; }

		num = FormatClean(num);

		num = parseInt(num);

		var samount = new String(num);

		for (var i = 0; i < Math.floor((samount.length-(1+i))/3); i++)
		{
			samount = samount.substring(0,samount.length-(4*i+3)) + CommaDelimiter + samount.substring(samount.length-(4*i+3));
		}

	}

	catch (exception) { AlertError("Format Number",e); }
	return minus + samount;

}

function FormatCents(amount)
{

	var cents = '';

	try
	{
		amount = parseInt(amount);
		var samount = new String(amount);

		if (samount.length == 0) { return '00'; }
		if (samount.length == 1) { return '0' + samount; }
		if (samount.length == 2) { return samount; }
	
		cents =  samount.substring(samount.length -2,samount.length);

	}
	catch (exception) { AlertError("Format Cents",e); }
	return cents;

}

function FormatDollar(amount,CommaDelimiter)
{

	try
	{

		amount = parseInt(amount);

		var samount = new String(amount);

		if (samount.length < 3) { return 0; }

		samount =  samount.substring(0,samount.length -2);

		for (var i = 0; i < Math.floor((samount.length-(1+i))/3); i++)
		{
			samount = samount.substring(0,samount.length-(4*i+3)) + CommaDelimiter + samount.substring(samount.length-(4*i+3));
		}

	}

	catch (exception) { AlertError("Format Comma",e); }
	return samount;

}

function AlertError(MethodName,e)
{

	if (e.description == null) { alert(MethodName + " Exception: " + e.message); }
	else {  alert(MethodName + " Exception: " + e.description); }

}

function SetDefaultFormValues(box)
{
	document.getElementById(box).value = FormatCurrency(document.getElementById(box).value,2);
}

//	END
//
//	CURRENCY NUMBER FORMATTING
//
//

function showHide(show, total)
{

	for (i = 1; i <= (total); i++)
	{
		document.getElementById('list_' + i).style.display = 'none';
	}

	document.getElementById('list_' + show).style.display = 'block';

}

function showHideGraph(show, total)
{

	for (i = 1; i <= (total); i++)
	{
		document.getElementById('graph_' + i).style.display = 'none';
		document.getElementById('indexrow_' + i).className = 'odd'
	}

	document.getElementById('graph_' + show).style.display = 'block';
	document.getElementById('indexrow_' + show).className = 'even';

}


 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.0
      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 && document.getElementById) x=document.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];}
    }

    function MM_showHideLayers() { //v3.0
      var i,p,v,obj,args=MM_showHideLayers.arguments;
      for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
      if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
      obj.visibility=v; }
    }

    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      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);
	
	function MM_controlShockwave(objStr,x,cmdName,frameNum) { //v3.0
      var obj=MM_findObj(objStr);
      if (obj) eval('obj.'+cmdName+'('+((cmdName=='GotoFrame')?frameNum:'')+')');
    }

    
    /**
 * Checks/unchecks all tables
 *
 * @param   string   the form name
 * @param   boolean  whether to check or to uncheck the element
 *
 * @return  boolean  always true
 */
function setCheckboxes(the_form, elementsname, do_check)
{
   
    var elts      = document.forms[the_form].elements[elementsname];
    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
            elts[i].checked = do_check;
        } // end for
    } else {
        elts.checked        = do_check;
    } // end if... else

    return true;
} // end of the 'setCheckboxes()' function

function jump(form, select) {
    var myindex=select.selectedIndex
    if (select.options[myindex].value != "-1")
    {
        form.submit();
    }
}