//$$$$$$$$$$$ Copyright $$$$$$$$$$$$
// This code is property of WAR-DOG (administrator@war-dog.org)
// and can exclusively be used on his homepage (http://www.war-dog,org/).
// Using this code on any other page is a violation of copyright infrigement.
// If you want to use this script in any of your pages ask for permission first!
//
// WAR-DOG @ august 2009

$(function() {
	$('#footer').slideDown(500);
	$('#slogan').fadeIn();
});

//mouse event: show drop down
function ShowDropDown(id) {
	$('#' + id).show();
}
//mouse event: hide drop down
function HideDropDown(id) {
	$('#' + id).hide();
}
//keydown: allow only numeric input
function keyOnlyNumericWEnterOnlyWoDot(e) {
    //validate input
	var keyIndex = (navigator.appName == "Netscape") ? e.which : window.event.keyCode;       
    // only allow numbers and backspace
	return  ((keyIndex>47 && keyIndex<58) || keyIndex==0 || keyIndex==8 || keyIndex==13 || keyIndex==44) ? true : false;
}
//ajax: get uptime time every 1 minute
function ajaxGetUptime() {	
	$.ajax({ url: 'ajaxuptime.asp', success: function(data) { $('#uptimeid').html(data); } });
	setTimeout("ajaxGetUptime()",30000);
}
//ajax: get my birthday
function ajaxGetBirthday() {
	$.ajax({ url: 'ajaxbirthday.asp', success: function(data) { $('#birthdayid').html(data); } });
	setTimeout("ajaxGetBirthday()",30000);
}

function SimpleGallery(position) {
	//check if any tags in element
	if (!document.getElementById('gallerythumbscontainer').getElementsByTagName) return;

	//check if any tags in element
	if (!document.getElementById('gallerythumbscontainer').getElementsByTagName("a")) return;
	//get elements 
	var anchors = document.getElementById('gallerythumbscontainer').getElementsByTagName('a');
	
	//loading image 
	document.getElementById('gallerymainimage').src = '/images/loading.gif';
	
	//loop elements
	for (var i=0; i < anchors.length; i++) {
		var anchor = anchors[i];
		//if we have our image link
		if (i == (position - 1) && anchor.getAttribute("href") && anchor.getAttribute("rel") == "gallery") {
			//load image		
			document.getElementById('gallerymainimage').src = anchor.getAttribute("href");	
		}
	}
}

//gallery variables
var scrollSpeed = 8; var scrollStep = 10; var timerLeft = ""; var timerRight = ""; 
function SimpleGalleryScrollLeft() {
	clearTimeout(timerRight) 
	document.getElementById('gallerythumbsholder').scrollLeft += scrollStep
	timerRight=setTimeout("SimpleGalleryScrollLeft()", scrollSpeed)
}
function SimpleGalleryScrollRight() {
	clearTimeout(timerLeft)
	document.getElementById('gallerythumbsholder').scrollLeft -= scrollStep
	timerLeft=setTimeout("SimpleGalleryScrollRight()", scrollSpeed)
}
function SimpleGalleryStopScroll() {
	clearTimeout(timerRight) 
	clearTimeout(timerLeft)
}

