//FW Resize Font Javascript//
/**
* FW Resize Font Javascript
* @package Joomla
* @copyright Copyright (C) 2006 Futureworkz Pte. Ltd. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/

function FWresizeFont(resize) {
	if (!document.getElementById) {
		return;
	}
		
	docBody = document.getElementsByTagName('body')[0];
	for (i = 0 ; i < tags.length ; i++ ) {		
		allTags = docBody.getElementsByTagName(tags[i]);
		
		if (resize > 0) {
			for (k = 0 ; k < allTags.length ; k++) {
				var size = parseInt(allTags[k].style.fontSize.substring(0,allTags[k].style.fontSize.length-2));
				if (size) {
					allTags[k].style.fontSize = (size + increment) + 'px';
				} else {
					allTags[k].style.fontSize = defaultSize + 'px';
				}
			}			
		} else {
			for (k = 0 ; k < allTags.length ; k++) {
				var size = parseInt(allTags[k].style.fontSize.substring(0,allTags[k].style.fontSize.length-2));
				if (size && size > 2) {
					allTags[k].style.fontSize = (size - increment) + 'px';
				} else {
					allTags[k].style.fontSize = defaultSize + 'px';
				}
			}			
		}
	}
	
	resize > 0 ? resizeCounter++ : resizeCounter--;
}

function setFontSize(resizeCounter) {
	docBody = document.getElementsByTagName('body')[0];
	for (i = 0 ; i < tags.length ; i++ ) {		
		allTags = docBody.getElementsByTagName(tags[i]);		
		for (k = 0 ; k < allTags.length ; k++) {
			var size = parseInt(allTags[k].style.fontSize.substring(0,allTags[k].style.fontSize.length-2));
			var resize = size + resizeCounter;			
			if (!size) {
				allTags[k].style.fontSize = (parseInt(defaultSize) + parseInt(resizeCounter)) + 'px';
			} else if (size && resize > 0) {
				allTags[k].style.fontSize = resize + 'px';
			}
		}
	}
}

function resetFontSize() {
	docBody = document.getElementsByTagName('body')[0];
	for (i = 0 ; i < tags.length ; i++ ) {		
		allTags = docBody.getElementsByTagName(tags[i]);		
		for (k = 0 ; k < allTags.length ; k++) {
			allTags[k].style.fontSize = defaultSize + 'px';
		}
	}
	
	resizeCounter = 0;
}
//cookie functions for remember the font sizes across pages
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
		else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

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 setUserOptions(){
	cookie = readCookie("FWresizeFont");
	if (cookie) {
		resizeCounter = cookie;
	} else {
		return null;
	}
	
	setFontSize(resizeCounter);
}

function saveSettings()
{
  createCookie("FWresizeFont", resizeCounter, 365);
}

window.onload = setUserOptions;
window.onunload = saveSettings;





/***********************************************
* Disable select-text script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
* Modified here to exclude form tags properly, cross browser by jscheuer1
***********************************************/
//form tags to omit:
var omitformtags=["input", "textarea", "select"]
function disableselect(e){
for (i = 0; i < omitformtags.length; i++)
if (omitformtags[i]==(e.target.tagName.toLowerCase()))
return;
return false
}
function reEnable(){
return true
}
function noSelect(){
if (typeof document.onselectstart!="undefined"){
document.onselectstart=new Function ("return false")
if (document.getElementsByTagName){
tags=document.getElementsByTagName('*')
for (j = 0; j < tags.length; j++){
for (i = 0; i < omitformtags.length; i++)
if (tags[j].tagName.toLowerCase()==omitformtags[i]){
tags[j].onselectstart=function(){
document.onselectstart=new Function ('return true')
}
if (tags[j].onmouseup!==null){
var mUp=tags[j].onmouseup.toString()
mUp='document.onselectstart=new Function (\'return false\');\n'+mUp.substr(mUp.indexOf('{')+2,mUp.lastIndexOf('}')-mUp.indexOf('{')-3);
tags[j].onmouseup=new Function(mUp);
}
else{
tags[j].onmouseup=function(){
document.onselectstart=new Function ('return false')
}
}
}
}
}
}
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
}
window.onload=noSelect;

<!--
//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;}
document.oncontextmenu=new Function("return false")
// --> 
