//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
//return true = enable right click,  return false = disable right click
document.oncontextmenu=new Function("return true")




//print function and print preview function
function print_preview() {
	//for right.js only
	document.getElementById("Topgo").style.visibility = 'hidden';
	
	var cancel_function_link = document.createElement('a');
	cancel_function_link.onclick = function(){ cancel_print_preview(); return false; };
	cancel_function_link.setAttribute('href', '#');	
	var cancel_function_link_text = document.createTextNode('Return to the existing page.');
	cancel_function_link.appendChild(cancel_function_link_text);

	var returnStatement = "<table><tr><td><a href='javascript:cancel_print_preview();'>Return to the existing page.</a> <a href='javascript:window.print();'>Print</a> <br><img src='../images/logo.jpg' /></td> <td align='left' valign='top' width='550'></td></tr></table>";
	
	
	document.getElementById('display').style.visibility='hidden';	
	document.getElementById('printer').innerHTML=returnStatement + "" + document.getElementById('printable').innerHTML + "";
	document.getElementById('printer').style.visibility='visible';	
	window.print();
}

function cancel_print_preview() {
	document.getElementById('display').style.visibility='visible';	
	document.getElementById('printer').style.visibility='hidden';		
}



//font size 
//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','table','tr','td','th','strong','a','span','li','ul');
var startSz=getFontSize();

function getFontSize() {
	if (document.cookie.indexOf("fontSize") < 0) {
		return 1;
	} else {
		var startStr = document.cookie.indexOf("fontSize") + 9;
		var endStr = document.cookie.indexOf(";", startStr);
		if (endStr == -1) {
			endStr = document.cookie.length;
		}
		return unescape(document.cookie.substring(startStr, endStr));
	}
}
		
function restFontSize(trgt)
{	//999 = rest
	changeFontSize( trgt, 999, 0 );
}
		
function changeFontSize( trgt, inc, type ) {
	/*
	//Specify spectrum of different font sizes:
	//var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
	if (type == 1) {
		var szs = new Array('80%','100%','120%','140%','150%');
	} else {
		var szs = new Array('100%','110%','120%','130%','140%','150%');
		var smallSzs = '100%';
	}

	if (!document.getElementById) return
	
	var d = document,cEl = null,sz = eval(startSz),i,j,cTags;

	if (type == 0) {
		sz += inc;
	}

	if ( sz < 0 ) sz = 0;
	if ( sz > (szs.length-1) ) sz = (szs.length-1);
	if ( inc == 999) sz = 1; //rest font size
	startSz = sz;
	
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) {
			cTags[ j ].style.fontSize = smallSzs;
		}
	}
	if (type == 0) {
		setCookie("fontSize", sz, nd, cpath, cdomain);
	}
	*/
}


// cookie section
nd= new Date();
nd.setTime (nd.getTime()+(365*24*60*60*1000));
//cdomain = (location.domain) ? location.domain : null;
cdomain = (location.domain) ? location.domain : null;
cpath = "/";

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
function getCookie(NameOfCookie)
{

// First we check to see if there is a cookie stored.
// Otherwise the length of document.cookie would be zero.

if (document.cookie.length > 0) 
{ 

// Second we check to see if the cookie's name is stored in the
// "document.cookie" object for the page.

// Since more than one cookie can be set on a
// single page it is possible that our cookie
// is not present, even though the "document.cookie" object
// is not just an empty text.
// If our cookie name is not present the value -1 is stored
// in the variable called "begin".

begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) // Note: != means "is not equal to"
{ 

// Our cookie was set. 
// The value stored in the cookie is returned from the function.

begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 

// Our cookie was not set. 
// The value "null" is returned from the function.

}
 
 


function setPopCookie(NameOfCookie, value, expiredays) 
{

// Three variables are used to set the new cookie. 
// The name of the cookie, the value to be stored,
// and finally the number of days until the cookie expires.
// The first lines in the function convert 
// the number of days to a valid date.

var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

// The next line stores the cookie, simply by assigning 
// the values to the "document.cookie" object.
// Note the date is converted to Greenwich Mean time using
// the "toGMTstring()" function.

document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}


function delCookie (NameOfCookie) 
{

// The function simply checks to see if the cookie is set.
// If so, the expiration date is set to Jan. 1st 1970.

if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}


