<!--//

function printPage() {
	var settings = "toolbar=yes,location=no,directories=yes,menubar=yes,";
	settings += "scrollbars=yes,width=650,height=600,left=100,top=25";
	$('#embedHtml').hide();
	var print_header = $('#print_header').html();
	var print_content = $('#print_content').html();
	var print_footer = $('#print_footer').html();
	var sitemap = $('#sitemap').html();
	
	var doc = window.open( "", "", settings );
	doc.document.open();
	doc.document.write( '<html><head><title>HansaConsult</title>' );
	doc.document.write( '</head><body onload="self.print();" style="padding:25px;">' );
	doc.document.write( '<link href="'+templateUrl+'css/css.css" rel="stylesheet" type="text/css" />' );
	doc.document.write( '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td><img src="'+mediaUrl+'Site/logo.png" alt="" /></td><td align="right" valign="bottom">' + sitemap + '</td></tr></table><hr />' );
	
	doc.document.write( '<h1>' + print_header + '</h1>' );
	doc.document.write( '<div class="printContents">' + print_content + '</div>' );
	doc.document.write( '<hr />' );
	doc.document.write( '<p class="footer">' + print_footer + '</p>' );
	doc.document.write( '</body></html>' );
	doc.document.close();
	$('#embedHtml').show();
	doc.focus();
}

function addPageToBookmarks( url, name ) {
	if( window.sidebar ) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel( name, url, "" );
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, name );
	} else if( window.opera && window.print ) { // Opera Hotlist
		return true;
	}
}

function hidediv( id ) {
	if( document.getElementById ) { // DOM3 = IE5, NS6
		document.getElementById( id ).style.visibility = 'hidden';
	} else {
		if( document.layers ) { // Netscape 4
			document.id.visibility = 'hidden';
		} else { // IE 4
			document.all.id.style.visibility = 'hidden';
		}
	}
}

function showdiv( id ) {
	if( document.getElementById ) { // DOM3 = IE5, NS6
		document.getElementById( id ).style.visibility = 'visible';
	} else {
		if( document.layers ) { // Netscape 4
			document.id.visibility = 'visible';
		} else { // IE 4
			document.all.id.style.visibility = 'visible';
		}
	}
}

function numbersonly( myfield, e, dec ) {
	var key;
	var keychar;
	
	if( window.event ) {
		key = window.event.keyCode;
	} else if( e ) {
		key = e.which;
	} else {
		return true;
	}
	
	keychar = String.fromCharCode( key );
	
// control keys
if ((key==null) || (key==0) || (key==8) ||
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}

function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}

// -->
