function printCss(){
    str = location.search;
    str = str.substring(1,str.length);
    str2= str.split("&");
    for(var i=0; i<str2.length; i++){
	str3 = str2[i].split("=");
	if(str3[0]=="style" && str3[1]=="print"){
	    if (document.getElementsByTagName) {
		var anchors = document.getElementsByTagName("link");
		for (var loop = 0; loop < anchors.length; loop++) {
		    var anchor = anchors[loop];
		    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "stylesheet") {
			anchor.href = "http://zy-com.net/css/print.css";
		    }
		}
	    }
	}
    }
}

function showHideFunc(id) {
    obj = document.getElementsByTagName("div");
    if (obj[id].style.display == 'block'){
	obj[id].style.display = 'none';
    }
    else {
	obj[id].style.display = 'block';
    }
}

function showHideFunc2(id, exid) {
    obj = document.getElementsByTagName("div");
    if (obj[id].style.display == 'block'){
	obj[id].style.display = 'none';
	obj[exid].style.display = 'block';
    }
    else {
	obj[id].style.display = 'block';
	obj[exid].style.display = 'none';
    }
}

function showPic (whichpic) {
    if (document.getElementById) {
	document.getElementById('placeholder').src = whichpic.href;
	if (whichpic.title) {
	    document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
	} else {
	    document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
	}
	return false;
    } else {
	return true;
    }
}

function relTags() {
    if (document.getElementsByTagName) {
	var anchors = document.getElementsByTagName("a");
	for (var loop = 0; loop < anchors.length; loop++) {
	    var anchor = anchors[loop];
	    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
		anchor.target = "_blank";
	    } else if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "popup") {
		anchor.onclick = function () {
		    openPopUpWindow(this);
		    return false;
		};
	    }
	}
    }
}

function openPopUpWindow(theURL) {
    winName = 'PopUp';
    features = 'scrollbars=yes, width=500, height=600';
    subWin = window.open(theURL,winName,features);
}

function openContentsWindow() {
    w = 800;
    h = 600;
    x = (screen.width  - w) / 2;
    y = (screen.height - h) / 2;
    subWin = window.open("check.html","openWindowCenter", "screenX="+x+",screenY="+y+",left="+x+",top="+y+",width="+w+",height="+h);
}


function relTags() {
	if (document.getElementsByTagName) {
		var anchors = document.getElementsByTagName("a");
		for (var loop = 0; loop < anchors.length; loop++) {
			var anchor = anchors[loop];
			c = anchor.className.split(" ").pop();
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
				anchor.target = "_blank";
			} else if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "popup") {
				anchor.onclick = function () {
					openPopUpWindow(this);
					return false;
				};
			} else if (anchor.getAttribute("href") && c == "toPageTop" && window.pageYOffset != null) {
				anchor.onclick = function() {
					pageTopId = setInterval("toPageTop()", 15);
					return false;
				}
			}
		}
	}
}


var pageTopId;
function toPageTop() {
	var y = window.pageYOffset/2;
	if (y < 1) {
		y = 0;
		clearInterval(pageTopId);
	}
	window.scrollTo(window.pageXOffset, y);
}



/* 
	Javascript to style odd/even table rows
	Derived from 'Zebra Tables' by David F. Miller (http://www.alistapart.com/articles/zebratables/)
	
	Modified by Jop de Klein, february 2005
	jop at validweb.nl
	http://validweb.nl/artikelen/javascript/better-zebra-tables/
*/

var stripe = function() {
	var tables = document.getElementsByTagName("table");	

	for(var x=0;x!=tables.length;x++){
		var table = tables[x];
		if (! table) { return; }
		
		var tbodies = table.getElementsByTagName("tbody");
		
		for (var h = 0; h < tbodies.length; h++) {
			var even = true;
			var trs = tbodies[h].getElementsByTagName("tr");
			
			for (var i = 0; i < trs.length; i++) {
				trs[i].onmouseover=function(){
					this.className += " ruled"; return false
				}
				trs[i].onmouseout=function(){
					this.className = this.className.replace("ruled", ""); return false
				}
				
				if(even)
					trs[i].className += " even";
				
				even = !even;
			}
		}
	}
}
/* 
	Javascript to style odd/even table rows
	Derived from 'Zebra Tables' by David F. Miller (http://www.alistapart.com/articles/zebratables/)
*/

addOnLoadListener(stripe);
addOnLoadListener(relTags);
addOnLoadListener(printCss);