var waSites = {
1 : [ "OSDEV Community", "www.osdcom.info" , [ 1004 ] ],
2 : [ "Time to Incorporate!", "www.inctime.com" , [] ],
3 : [ "Motorola V525", "www.motorola-v525.info" , [ 1001 ] ],
4 : [ "IntelliDir", "www.intellidir.com" , [] ],
1001 : [ "Motorola V360", "v360.webarticles.org" , [ 3 ] ],
1002 : [ "Flash Text Effects", "flashtexteffects.webarticles.org" , [ 1003, 1006, 1009, 1010, 1011, 1012, 1013 ] ],
1003 : [ "Flash Star Effects", "flashstareffects.webarticles.org" , [ 1002, 1006, 1009, 1010, 1011, 1012, 1013 ] ],
1004 : [ "VectorLinux", "vectorlinux.webarticles.org" , [ 1 ] ],
1005 : [ "PHP Security Guide", "phpsecurity.webarticles.org", [] ],
1006 : [ "Flash Water Effects", "flashwatereffects.webarticles.org", [ 1002, 1003, 1009, 1010, 1011, 1012, 1013 ] ],
1007 : [ "DHTML/Ajax Popups", "dhtmlpopups.webarticles.org", [] ],
1008 : [ "Go 2 Tuscany", "go2tuscany.webarticles.org", [] ],
1009 : [ "Flash Scary Effects", "flashscaryeffects.webarticles.org", [ 1002, 1003, 1006, 1010, 1011, 1012, 1013 ] ],
1010 : [ "Flash Girl Effects", "flashgirleffects.webarticles.org", [ 1002, 1003, 1006, 1009, 1011, 1012, 1013 ] ],
1011 : [ "Flash Nature Effects", "flashnatureeffects.webarticles.org", [ 1002, 1003, 1006, 1009, 1010, 1012, 1013 ] ],
1012 : [ "Flash Filter Effects", "flashfiltereffects.webarticles.org", [ 1002, 1003, 1006, 1009, 1010, 1011, 1013 ] ],
1013 : [ "Flash Random Effects", "flashrandomeffects.webarticles.org", [ 1002, 1003, 1006, 1009, 1010, 1011, 1012 ] ]
};

function Waf() {
	this.nodes = [
	[ "Flash Text Effects", "http://flashtexteffects.webarticles.org/", "fte.jpg" ],
	[ "Flash Star Effects", "http://flashstareffects.webarticles.org/", "fse.jpg" ],
	[ "Flash Water Effects", "http://flashwatereffects.webarticles.org/", "fwe.jpg" ],
	[ "Flash Girl Effects", "http://flashgirleffects.webarticles.org/", "fge.jpg" ],
	[ "Flash Scary Effects", "http://flashscaryeffects.webarticles.org/", "fsce.jpg" ],
	[ "Flash Nature Effects", "http://flashnatureeffects.webarticles.org/", "fne.jpg" ],
	[ "Flash Filter Effects", "http://flashfiltereffects.webarticles.org/", "ffe.jpg" ],
	[ "Flash Random Effects", "http://flashrandomeffects.webarticles.org/", "fre.jpg" ]
	];
	this.status = 0;
	this.obj = null;
	this.tobj = null;
	this.counter = 0;
	this.interval = null;
	this.sinterval = null;
	this.yOffset = 0;
	this.yOffsetMax = 338 - this.nodes.length * 76;
	
	this.Update = function() {
		var sy, cy;
		
		if( self.pageYOffset ) {
			sy = self.pageYOffset;
		} else if( document.documentElement && document.documentElement.scrollTop ) {
			sy = document.documentElement.scrollTop;
		} else if( document.body ) {
			sy = document.body.scrollTop;
		}

		if( self.innerHeight ) {
			cy = self.innerHeight;
		} else if( document.documentElement && document.documentElement.clientHeight ) {
			cy = document.documentElement.clientHeight;
		} else if( document.body ) {
			cy = document.body.clientHeight;
		}
		
		this.obj.style.top = (cy / 2 - 200 + sy) + "px";
		if( this.status ) this.obj.style.left = "0px";
		else this.obj.style.left = "-81px";
	}
	
	this.Render = function() {
		var table = "<table cellpadding='0' cellspacing='0' width='76' border='0' id='waftab' name='waftab' style='position: relative'>";
		
		for( site in this.nodes ) {
			node = this.nodes[site];
			table += "<tr><td><a target='_blank' href='"+node[1]+"' title='"+node[0]+"'><img alt='"+node[0]+"' src='http://toolbar.webarticles.org/waf/images/"+node[2]+"' width='76' height='76' border='0'></a></td></tr>";
		}
		
		table += "</table>";
		
		document.write("<div style='display: none; position: absolute' id='wafbar' name='wafbar'><table width='100' border='0' cellpadding='0' cellspacing='0'><tr><td colspan='5'><img src='http://toolbar.webarticles.org/waf/images/a.gif' width='81' height='3' alt=''></td><td rowspan='7'><img onclick='_Waf.Show()' style='cursor: hand; cursor:pointer' src='http://toolbar.webarticles.org/waf/images/trigger.gif' width='19' height='400' alt=''></td></tr><tr><td colspan='2' rowspan='2'><img src='http://toolbar.webarticles.org/waf/images/b.gif' width='13' height='22' alt=''></td><td><img onclick='_Waf.Hide()' style='cursor: hand; cursor:pointer' src='http://toolbar.webarticles.org/waf/images/hide.gif' width='58' height='18' alt=''></td><td colspan='2' rowspan='2'><img src='http://toolbar.webarticles.org/waf/images/c.gif' width='10' height='22' alt=''></td></tr><tr><td><img src='http://toolbar.webarticles.org/waf/images/d.gif' width='58' height='4' alt=''></td></tr><tr><td rowspan='4'><img src='http://toolbar.webarticles.org/waf/images/e.gif' width='4' height='375' alt=''></td><td colspan='3'><img onmouseover='_Waf.scrollUp()' onmouseout='_Waf.stopScrolling()' style='cursor: hand; cursor:pointer' src='http://toolbar.webarticles.org/waf/images/goup.jpg' width='76' height='16' alt=''></td><td rowspan='4'><img src='http://toolbar.webarticles.org/waf/images/f.gif' width='1' height='375' alt=''></td></tr><tr><td colspan='3' width='76' height='338'><div style='width: 76px; overflow: hidden; height: 338px'>"+table+"</div></td></tr><tr><td colspan='3'><img onmouseover='_Waf.scrollDown()' onmouseout='_Waf.stopScrolling()' style='cursor: hand; cursor:pointer' src='http://toolbar.webarticles.org/waf/images/godown.gif' width='76' height='16' alt=''></td></tr><tr><td colspan='3'><img src='http://toolbar.webarticles.org/waf/images/g.gif' width='76' height='5' alt=''></td></tr><tr><td><img src='http://toolbar.webarticles.org/waf/images/spacer.gif' width='4' height='1' alt=''></td><td><img src='http://toolbar.webarticles.org/waf/images/spacer.gif' width='9' height='1' alt=''></td><td><img src='http://toolbar.webarticles.org/waf/images/spacer.gif' width='58' height='1' alt=''></td><td><img src='http://toolbar.webarticles.org/waf/images/spacer.gif' width='9' height='1' alt=''></td><td><img src='http://toolbar.webarticles.org/waf/images/spacer.gif' width='1' height='1' alt=''></td><td><img src='http://toolbar.webarticles.org/waf/images/spacer.gif' width='19' height='1' alt=''></td></tr></table></div>");
	};
	
	this.getObject = function() {
		this.obj = document.getElementById("wafbar");
		this.tobj = document.getElementById("waftab");
	}
	
	this.Display = function() {
		this.obj.style.display = "block";
	}
	
	this._MoveBar = function( dir ) {
		if( dir ) this.obj.style.left = (0 - this.counter) + "px";
		else this.obj.style.left = (this.counter - 82) + "px";
		this.counter--;
		
		if( ! this.counter ) {
			clearInterval(this.interval);
			this.status = dir;
		}
	}
	
	this.Show = function() {
		if( this.status ) return;
		this.counter = 81;
		this.interval = setInterval("_Waf._MoveBar(1)", 1);
	}
	
	this.Hide = function() {
		if( ! this.status ) return;
		this.counter = 81;
		this.interval = setInterval("_Waf._MoveBar(0)", 1);
	}
	
	this._Scroll = function( dir ) {
		this.yOffset += dir;
		this.tobj.style.top = this.yOffset + "px";
		if( this.yOffset == 0 || this.yOffset == this.yOffsetMax )
		clearInterval( this.sinterval );
	}
	
	this.stopScrolling = function() {
		clearInterval( this.sinterval );
	}
	
	this.scrollUp = function() {
		if( this.yOffset == 0 ) return;
		this.sinterval = setInterval("_Waf._Scroll(1)", 1);
	}
	
	this.scrollDown = function() {
		if( this.yOffset == this.yOffsetMax ) return;
		this.sinterval = setInterval("_Waf._Scroll(-1)", 1);
	}
	
	this.getCookie = function() {
		var search = "waftrk=";
		var ret = "";

		if( document.cookie.length > 0 ) {
			offset = document.cookie.indexOf( search );
			if( offset != -1 ) {
				offset += search.length;
				end = document.cookie.indexOf( ";", offset );
				if( end == -1 ) end = document.cookie.length;
				ret = unescape( document.cookie.substring( offset , end ) );
			}
		}

		return ret;
	}
	
	this.Render();
	this.getObject();
	this.Update();
	this.Display();
	
	window.onscroll = function() { _Waf.Update(); };
	window.onresize = function() { _Waf.Update(); };
	
	if( this.getCookie() == '' ) {
		window.onload = function() { setTimeout("_Waf.Show()", 750); };
		document.cookie = "waftrk=yes";
	}
}

function waToolbarSrcClick() {
	document.getElementById("query_string").value = '';
	document.getElementById("query_string").style.color = '#000';
}

function waToolbarKillForm() {
	var objs = document.getElementsByTagName("object");

	for( i = 0 ; i < objs.length ; i++ ) {
		objs[i].style.visibility = "visible";
	}

	document.getElementById("wablank").innerHTML = "";
}

function waToolbarContactForm() {
	var objs = document.getElementsByTagName("object");

	for( i = 0 ; i < objs.length ; i++ ) {
		objs[i].style.visibility = "hidden";
	}

	var sender = "g" + Math.floor( Math.random() * 1001 );
	var email = "sd" + Math.floor( Math.random() * 1001 );
	var message = "safd" + Math.floor( Math.random() * 1001 );
	var ptitle = "asjkf" + Math.floor( Math.random() * 1001 );
	var purl = "mbva" + Math.floor( Math.random() * 1001 );

	var sx, sy;
	if( self.pageYOffset ) {
		sx = self.pageXOffset;
		sy = self.pageYOffset;
	} else if( document.documentElement && document.documentElement.scrollTop ) {
		sx = document.documentElement.scrollLeft;
		sy = document.documentElement.scrollTop;
	} else if( document.body ) {
		sx = document.body.scrollLeft;
		sy = document.body.scrollTop;
	}

	var cx, cy;
	if( self.innerHeight ) {
		cx = self.innerWidth;
		cy = self.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight ) {
		cx = document.documentElement.clientWidth;
		cy = document.documentElement.clientHeight;
	} else if( document.body ) {
		cx = document.body.clientWidth;
		cy = document.body.clientHeight;
	}

	var dtop = (cy + sy) / 2 - 150;
	var dleft = (cx + sx) / 2 - 190;

	document.getElementById("wablank").innerHTML = "<div id='wactncontainer' name='wactncontainer' style='top: "+dtop+"px; left: "+dleft+"px'><table id='wactntable' name='wactntable' cellpadding='0' cellspacing='0' border='0'><tr><td><img src='http://toolbar.webarticles.org/media/cwin_title.gif' width='356' height='23'></td><td><a href='#' onClick='waToolbarKillForm();'><img src='http://toolbar.webarticles.org/media/cwin_close.gif' border='0' width='24' height='23'></a></td></tr><tr><td colspan='2' id='wactnbody' name='wactnbody'><div align='center'><form action='http://toolbar.webarticles.org/tbc.php' method='post'><input type='hidden' name='"+ptitle+"' value='"+document.title+"'><input type='hidden' name='"+purl+"' value='"+location.href+"'><table id='wacttab' name='wacttab'><tr><td colspan='2' style='height: 40px'>Please fill in the following form with accurate information.</td></tr><tr><td>Your Name</td><td style='text-align: right'><input class='wacttext' type='text' name='"+sender+"'></td></tr><tr><td>E-mail</td><td style='text-align: right'><input class='wacttext' type='text' name='"+email+"'></td></tr><tr><td colspan='2'>Message<br><textarea class='wacttarea' name='"+message+"'></textarea></td></tr><tr><td><input onClick='waToolbarKillForm();' type='reset' value='  Cancel  '></td><td style='text-align: right'><input type='submit' value='  Send  '></td></tr><tr><td class='wactflash' colspan='2'>Note: Flash elements might disappear while using this contact form due to unwanted cross browser effects.</td></tr></table></form></div></td></tr></table></div>";
}

function waRelatedSwitch( selid ) {
	if( ! selid.selectedIndex ) return;
	window.location = "http://" + waSites[selid.options[selid.selectedIndex].value][1];
}

function waToolbarRender( siteid ) {
	if( location.href.indexOf(waSites[siteid][1]) == -1 ) {
		window.alert("\n\n\nThe unauthorized use of the WebArticles Toolbar outside\nof the WebArticles Media Network is strictly forbidden!\n\n\nThe WebArticles Toolbar is an intellectual property\n of Ciprian Dosoftei.\n\n\n\nCopyright (C) 2006 Ciprian Dosoftei. All rights reserved.\n\n\n");
		return;
	}

	var trelated = waSites[siteid][2].length;
	var srelated = "<select name='watbarrel' id='watbarrel'";

	if( ! trelated ) {
		srelated += " disabled><option>No related sites</option>";
	} else {
		srelated += " onChange='waRelatedSwitch(this)'><option value='0'>Related Sites</option>";
		
		for( i = 0 ; i < trelated ; i++ ) {
			trid = waSites[siteid][2][i];
			srelated += "<option value='" + trid + "'>" + waSites[trid][0] + "</option>";
		}
	}

	srelated += "</select>";

	document.body.style.margin = "30px 0 0 0";
	document.write("<link rel='stylesheet' type='text/css' href='http://toolbar.webarticles.org/toolbar.css'><div id='watbcontainer' name='watbcontainer'><div id='wablank' name='wablank'></div><table border='0' cellpadding='0' cellspacing='0' id='watbar' name='watbar'><tr><td name='watbarlogo' id='watbarlogo'><a href='http://www.webarticles.org/' target='_blank'><img src='http://toolbar.webarticles.org/media/wa-logo.jpg'></a></td><td id='wax'><a href='http://www.jdoqocy.com/i3102cy63y5LPVVMUPULNMQVUVQR' target='_blank' onmouseover='window.status=\'http://www.biblio.com\';return true;' onmouseout='window.status=\' \';return true;'>Free shipping on select books.  No minimum purchase</a><img src='http://www.tqlkg.com/j2102xjnbhf04AA19490215A9A56' width='1' height='1' border='0'/></td><td id='watbarccell' name='watbarccell'><input id='watbarcontact' name='watbarcontact' type='reset' value=' Contact Us ' onClick='waToolbarContactForm()'></td><td name='watbarrelcell' id='watbarrelcell' width='150'>"+srelated+"</td></tr></table></div>");
	
	switch( siteid ) {
		case 1002:
		case 1003:
		case 1006:
		case 1009:
		case 1010:
		case 1011:
		case 1012:
		case 1013: document.write("<script type='text/javascript'>var _Waf = new Waf();</script>"); break;
	}
}