// JavaScript Document
var divname;
var opc=0;

/* Initialization code. */


function handle(delta) 
{
	if (delta<0)
	//scrollling down
	{
		if (document.getElementById('aboutus_div').style.display == 'block')
			scrollDown('aboutus_txt');
		if (document.getElementById('profile_div').style.display == 'block')
			scrollDown('PRO_text');
			if (document.getElementById('team_div').style.display == 'block')
			scrollDown('team_txt');
			if (document.getElementById('contactus_div').style.display == 'block')
			scrollDown('contactus_txt');
						if (document.getElementById('portfolio_imgs').style.display == 'block')
			scrolllRight('strip_div');
	}
		if (delta>0)
	//scrollling down
	{
		if (document.getElementById('aboutus_div').style.display == 'block')
			scrollUp('aboutus_txt');
			if (document.getElementById('profile_div').style.display == 'block')
			scrollUp('PRO_text');
			if (document.getElementById('team_div').style.display == 'block')
			scrollUp('team_txt');
				if (document.getElementById('contactus_div').style.display == 'block')
			scrollUp('contactus_txt');
				if (document.getElementById('portfolio_imgs').style.display == 'block')
			scrolllLeft('strip_div');
	}
}

function wheel(event){
        var delta = 0;
        if (!event) event = window.event;
        if (event.wheelDelta) {
                delta = event.wheelDelta/120;
                if (window.opera) delta = -delta;
        } else if (event.detail) {
                delta = -event.detail/3;
        }
        if (delta)
                handle(delta);
}
if (window.addEventListener)

        window.addEventListener('DOMMouseScroll', wheel, false);

window.onmousewheel = document.onmousewheel = wheel;


function hideDivs()
{
	window.document.getElementById('aboutus_div').style.display= 'none';
	window.document.getElementById('profile_div').style.display= 'none';
	window.document.getElementById('team_div').style.display= 'none';
	window.document.getElementById('contactus_div').style.display= 'none';
	window.document.getElementById('portfolio_div').style.display= 'none';
	window.document.getElementById('atl_div').style.display= 'none';
	window.document.getElementById('btl_div').style.display= 'none';
	window.document.getElementById('portfolio_imgs').style.display= 'none';
}
function showDiv (divname)
{
	hideDivs();
	//set opacity to null
	window.document.getElementById(divname).style.opacity = 0;
	window.document.getElementById(divname).style.filter= "alpha(opacity=0)";
	window.document.getElementById(divname).style.display= 'block';
	//fade it
	fadeIn(divname);
}
function showDiv1 (divname)
{
	hideDivs();
	window.document.getElementById(divname).style.display= 'block';
}
function fadeIn (divname)
{
	 elem = window.document.getElementById(divname);
	 //opc = elem.style.opacity;
	 if (opc <1)
	 {
		opc +=0.05;
		elem.style.opacity = opc;
		elem.style.filter ="alpha(opacity="+opc*100+")";
		timeoutid = setTimeout("fadeIn('" + divname +"')", 20,"JavaScript");
	 }
	 else
	 {
		 opc=0;
		 clearTimeout(timeoutid);
	 }
}
function scrollUp (id)
{
	window.document.getElementById(id).scrollTop -= 80;
}
function scrolllLeft(id)
{
	window.document.getElementById(id).scrollLeft -= 80;
}
function scrolllRight(id)
{
	window.document.getElementById(id).scrollLeft +=80;
}
function scrollDown (id)
{
	window.document.getElementById(id).scrollTop += 80;
}
function fillImg (name)
{
	window.document.getElementById('bigimagelink').href ="image.php?imgname="+name;
	window.document.getElementById('bigimagesrc').src="images/thumbs/"+ name +".jpg";
}
function fillVideo (name)
{
	window.document.getElementById('bigimagelink').href ="video.php?vidname="+name;
	//window.document.getElementById('bigimagelink').onclick=" \"window.open('video.php?vidname="+name+"','height=255,width=250,toolbar=no,directories=no,status=no,menubar=no,scrollbars=np,resizable=yes'); return false;\"";
	window.document.getElementById('bigimagelink').onclick=function(){var linkname = "video.php?vidname="+name; window.open(linkname,name,'height=280,width=350,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); return false;}
	window.document.getElementById('bigimagesrc').src="images/thumbs/"+ name +".jpg";
}

function generatePortfolio (divname, tag, size)
{
	div = window.document.getElementById(divname);
	var HTML = "<table cellspacing=\"10px\"><tbody><tr>";
	for (i=1;i<=size;i++)
	{
		HTML += "<td onclick=\"fillImg('"+tag+i+"');\"><img src=\"images/thumbs/"+tag+i+"s.jpg\" /></td>";
	}
	HTML +="</tr></tbody></table>";
	div.innerHTML =HTML;
	window.document.getElementById('bigimagelink').href ="#";
	window.document.getElementById('bigimagesrc').src="bg_repeat.jpg";
}
function generatePortfolioVideo (divname, tag, size)
{
	div = window.document.getElementById(divname);
	var HTML = "<table cellspacing=\"10px\"><tbody><tr>";
	for (i=1;i<=size;i++)
	{
		HTML += "<td onclick=\"fillVideo('"+tag+i+"');\"><img src=\"images/thumbs/"+tag+i+"s.jpg\" /></td>";
	}
	HTML +="</tr></tbody></table>";
	div.innerHTML =HTML;
	window.document.getElementById('bigimagelink').href ="#";
	window.document.getElementById('bigimagesrc').src="bg_repeat.jpg";
}

