function roll(obj, state)
{
	var global = "style/images/global/btn/";
	if(state==0){obj.src=global+obj.id+"Hover"+".png";}
	else{obj.src=global+obj.id+".png";}
	
	/*if(obj.id=="btnGfi" || obj.id=="btnApps" || obj.id=="btnServices" || obj.id=="btnMedia"){
		if(state==0){Effect.BlindDown(obj.id+"Menu", { duration: 0.2 });}
		//else{Effect.BlindUp(obj.id+"Menu", { duration: 0.8 })}
	}*/
}

function adjust_sidebar(cnt){
	
	h=(cnt*30)+100;
		if(h>parseInt(document.getElementById("content").clientHeight))
			{
				document.getElementById("content").style.height=h+"px";
				//document.getElementById("sidebar").style.height=h+"px";
			}

}

function menu(obj, state)
{
	var objID = document.getElementById(obj).id;
	if(state==0){Effect.toggle(objID, 'blind', { duration: 0.2 });}
	else{Effect.toggle(objID, 'blind', { duration: 2.0 });}
}

function applicationsLink(obj, state)
{
	if(state==0){obj.className="applications_sidebar_link_hover";}
	else{obj.className="applications_sidebar_link";}
}

function opentv()
{
	javascript:window.open( "http://movies.apple.com/media/us/iphone/2009/ads/apple-iphone3g-ad-check-us-20090127_848x480.mov", "iPhoneAd", "status = 0, height = 500, width = 850, resizable = 0" );
}

function rssExpand(obj)
{
	if(obj.className=="rss_item"){
		obj.className="rss_item_expand";
		document.getElementById(obj.id+"Expand").innerHTML="-";
	}
	else{
		obj.className="rss_item";
		document.getElementById(obj.id+"Expand").innerHTML="+";
	}
}

function subscribe(){
	var email=document.getElementById("subscribe");
	if(checkEmail(email)==false){alert("Invalid E-Mail Address"); email.focus(); return -1;}
	document.location="index.php?page=subscribe&email="+email.value;
}

// Contact Form Functions
	function checkEmail(email)
	{
		var characters = /^[^@]+@[^@]+.[a-z]{2,}$/i;
		if (email.value.search(characters) == -1)
		{	
			return false;
		}
		return true;
	}
	
	function checkPhone(obj, num)
	{
		size=obj.value.length;
		if(isNaN(obj.value) == true){return false;}
		if(size < num){return false;}
		return true;
	}

	function checkForm(obj)
	{
		if(obj.value == "" || obj.value == null)
		{
			return false;
		}
		
		return true;
	}

	function checkAddress(address, state, zip, city, country)
	{	
		
		if(address.value.length == 0 || address.value == null){return -3;}
		if(city.value.length == 0 || city.value == null){return -4;}
		if(state.value.length < 2 || state.value == null){return -2;}
		if(isNaN(zip.value) == true){return -1;}
		if(zip.value.length < 5){return -1;}
		if(country.value == "" || country.value == null){return -5;}

		return 0;
	}
	
	function checkContactForm()
	{
		reason=document.getElementById('reason');
		first=document.getElementById('first');
		last=document.getElementById('last');
		area=document.getElementById('area');
		access=document.getElementById('access');
		local=document.getElementById('local');
		email=document.getElementById('email');
		info=document.getElementById('info');
			if(checkForm(reason)==false){alert('Select a Subject'); return -1;}
			if(checkForm(first)==false){alert('Enter a First Name'); first.focus(); return -1;}
			if(checkForm(last)==false){alert('Enter a Last Name'); last.focus(); return -1;}
			//if(checkPhone(area, 3)==false){alert('Enter a valid phone number.'); area.focus(); return -1;}
			//if(checkPhone(access, 3)==false){alert('Enter a valid phone number.'); access.focus(); return -1;}
			//if(checkPhone(local, 4)==false){alert('Enter a valid phone number.'); local.focus(); return -1;}
			if(checkEmail(email)==false){alert('Enter a valid email address.'); email.focus(); return -1;}
			
		document.getElementById('form').action = 'index.php?page=support&option=send';
		document.getElementById('form').submit();
			
	}

	function check_dev(){
		
			first=document.getElementById('first');
			last=document.getElementById('last');
			area=document.getElementById('area');
			access=document.getElementById('access');
			local=document.getElementById('local');
			email=document.getElementById('email');
			ref=document.getElementById('ref');
			
			
			if(checkForm(first)==false){alert('Enter a First Name'); first.focus(); return false;}
			if(checkForm(last)==false){alert('Enter a Last Name'); last.focus(); return false;}
			if(checkPhone(area, 3)==false){alert('Enter a valid phone number.'); area.focus(); return false;}
			if(checkPhone(access, 3)==false){alert('Enter a valid phone number.'); access.focus(); return false;}
			if(checkPhone(local, 4)==false){alert('Enter a valid phone number.'); local.focus(); return false;}
			if(checkEmail(email)==false){alert('Enter a valid email address.'); email.focus(); return false;}
			if(checkForm(ref)==false){alert('How did you hear about us?'); ref.focus(); return false;}
			
		return true;
		
		}


// Screenshot Functions
var count=0; 
var animation=null;

	function moveForward()
	{
		document.getElementById("screen").style.left=parseInt(document.getElementById("screen").style.left, 10)-20+"px";
		if(parseInt(document.getElementById("screen").style.left, 10) <= 730*count*-1){animationCount=0; clearInterval(animation); animation=null;}
	}
	
	function moveBackwards()
	{
		document.getElementById("screen").style.left=parseInt(document.getElementById("screen").style.left, 10)+20+"px";
		if(parseInt(document.getElementById("screen").style.left, 10) >= 730*count*-1){animationCount=0; clearInterval(animation); animation=null;}
	}

	function changeScreen(direction)
	{
		if(animation == null)
		{
			if(direction == 1)
			{
				if(count+1 < maxCnt){count++; animation=setInterval("moveForward()", 1); }
			}
			else if(direction == -1)
			{
				if(count != 0){count--; animation=setInterval("moveBackwards()", 1); }
			}
			
			if(count+1 == maxCnt){document.getElementById("next").className="screen_next_inactive"}
			else{document.getElementById("next").className="screen_next"}
			if(count == 0){document.getElementById("previous").className="screen_previous_inactive"}
			else{document.getElementById("previous").className="screen_previous"}
		}
	}

	function generateScreen()
	{
		while(count < maxCnt)
		{
			document.getElementById("screen"+count).style.left=730*count+"px";
			count++;
		}
		count=0;
	}
	