// global vars, functions for sonorasansoo webdesigns site, custom written by tntemerson

var site_version = "2.0";



function get_copyRight(holder) {
	lastmod = document.lastModified;
	d = new Date(lastmod);
	day = d.getDate();
	
	if (day < 10) {
		day = "0" + day;
	}
	month = d.getMonth() +1;
	if (month < 10) {
		month = "0" + month;
	}
	
	year = d.getYear();
	year = year.toString();
	temp = year.charAt(0);
	if (temp == "1") {
		year = year.replace(/1/,"20");
	}
	return  "copyright &copy "+month+"."+day+"."+year+" "+holder ; 

}



	function open_newWindow () {

		var pop_file = "";
		var	sw=screen.availWidth;
		var	sh=screen.availHeight;
		
		
		sw = sw - 8;
		sh = sh - 80;
		var leftPos = 0;
		var topPos = 0;

		var tb = 0;
		var loc = 0;
		
	if(window.XMLHttpRequest) {
		if(window.ActiveXObject) {
			// IE 7
			//alert("ie7");

			tb=0;
			loc =1;		
		}
		else {
			// Opera, Safari, Firefox
			//alert("firefox");

			tb=1;
			loc=0;
			
		}
	}
	else {
		//IE 6 and below
		//alert("ie6");

		tb=1;
		loc=0;

	}



	
		if (window.sss_main_window == null) {
			sss_main_window =	window.open("sss_main.html","sss_main_popup","location="+loc+",menubar=0,scrollbars=1,toolbar="+tb+",titlebar=1,status=1,resizable=1,width="+sw+",height="+sh+",left="+leftPos+",top="+topPos);
			sss_main_window.moveTo(0,0);
		}
		else {
			if (sss_main_window.closed) {
				sss_main_window =	window.open("sss_main.html","sss_main_popup","location="+loc+",menubar=0,scrollbars=1,toolbar="+tb+",titlebar=1,status=1,resizable=1,width="+sw+",height="+sh+",left="+leftPos+",top="+topPos);
				sss_main_window.moveTo(0,0);
			}
			else {
				sss_main_window.moveTo(0,0);
				tsw = screen.availWidth;
				tsh = screen.availHeight;
				sss_main_window.resizeTo(tsw,tsh);
				sss_main_window.focus();
			}
		}
		


}


function close_childWindow() {
		if (window.sss_main_window != null) {
			if (!window.sss_main_window.closed) {
				window.sss_main_window.close();
			}
		}
}



var maxFontSize = 13;
var minFontSize = 7;
var curFontSize = 10;
var curFontFace = 0;
var curFontColor = 0;
var familyArray = new Array('arial,helvetica,san-serif','times,"Times roman",serif','"courier new"');
var colorArray = new Array('#cbb175','#dcc286','#edd397','#FEE4A8','ffffff');


function changeFontSize(id,direction) {

	if (document.getElementById) {

		curFontSize = top.sessionFontSize;

		if (direction == "up") {
			if (curFontSize < maxFontSize) {
				curFontSize++;
			}

		} else {
			if (curFontSize > minFontSize) {
				curFontSize--;
			}
		}
		tnt_mid.document.getElementById(id).style.fontSize = curFontSize+"pt";

		aLength = tnt_mid.document.links.length;
		if (aLength > 0) {
			for (i = 1; i <= aLength; i++) {
				tnt_mid.document.links[i-1].style.fontSize = curFontSize+"pt";
			}
		}

		top.sessionFontSize = curFontSize;

	} else {
		return;
	}

}


function changeFontFace(id) {

	if (document.getElementById) {

		curFontFace = top.sessionFontFace;

		if (curFontFace < familyArray.length - 1) {
			curFontFace++;
		} else {
			curFontFace = 0;
		}
		tnt_mid.document.getElementById(id).style.fontFamily = familyArray[curFontFace];
		aLength = tnt_mid.document.links.length;
		if (aLength > 0) {
			for (i = 1; i <= aLength; i++) {
				tnt_mid.document.links[i-1].style.fontFamily = familyArray[curFontFace];
			}
		}
		top.sessionFontFace = curFontFace;

	} else {
		return;
	}
}



function changeFontColor(id) {

	if (document.getElementById) {

		curFontColor = top.sessionFontColor;

		if (curFontColor < colorArray.length - 1) {
			curFontColor++;
		} else {
			curFontColor = 0;
		}
		tnt_mid.document.getElementById(id).style.color = colorArray[curFontColor];
		top.sessionFontColor = curFontColor;

	} else {
		return;
	}
}


function hideFontManager(id,state) {

	if (document.getElementById) {

		if (state == "show") {
			top.document.getElementById('font_manager').style.visibility = 'visible';
		}
		else {
			top.document.getElementById('font_manager').style.visibility = 'hidden';
		}
		document.getElementById(id).style.fontSize = top.sessionFontSize+"pt";
		document.getElementById(id).style.fontFamily = familyArray[top.sessionFontFace];
		document.getElementById(id).style.color = colorArray[top.sessionFontColor];
		aLength = document.links.length;
		if (aLength > 0) {
			for (i = 1; i <= aLength; i++) {
				document.links[i-1].style.fontSize = top.sessionFontSize+"pt";
				document.links[i-1].style.fontFamily = familyArray[top.sessionFontFace];
			}
		}

	} else {
		return;
	}
}
