function submitAll() {
	document.allComments.submit();
}
function submitID(id) {
		document.deleteComment.commentID.value=id;
}
function submitDel(){
	document.deleteComment.submit();
}
	
function scrollNav(id){
  $('html, body').animate({
    	scrollTop: $(id).offset().top
	}, 2000);	
}
function overColor(color) {
	switch (color) {
		case 'red':
			document.getElementById('topBg').style.backgroundColor = '#C99';
			break;
		case 'blue':
			document.getElementById('topBg').style.backgroundColor = '#99C';
			break;
		case 'green':
			document.getElementById('topBg').style.backgroundColor = '#9C9';
			break;
		case 'cyan':
			document.getElementById('topBg').style.backgroundColor = '#9CC';
			break;
		case 'magenta':
			document.getElementById('topBg').style.backgroundColor = '#C9C';
			break;
		case 'yellow':
			document.getElementById('topBg').style.backgroundColor = '#CC9';
			break;
		case 'black':
			document.getElementById('topBg').style.backgroundColor = '#CCC';
			break;
		default:
			document.getElementById('topBg').style.backgroundColor = '';
		
	}
}

function revertColor(){
		overColor(readCookie('color'));
}

function submitColor(color) {
	setCookie('color', color);
	overColor(color);
	
}

FB.Event.subscribe('comment.create', function(response) {
	document.sendemail.submit();
});


 function yesReady() {
		$('#wait').fadeOut('slow', function(){	
				$(".slide").animate({height: "49.9%"}, 1000, function(){
						$(".slide").animate({height: "49%"}, 200, function() {
							$(".slide").animate({height: "0"}, function() {
								ready();
							});
						});	
					
				});
		});
		 
		//setCookie("visited", 1, 1);
  }


function ready() {
			//document.getElementById('nav').style.top ="100%";
			document.body.style.overflowY = "scroll";
			//document.getElementById('box').style.display ="none";
			$(".slide").css({'display': 'block'});
			$("#container").fadeIn('slow', function() {
				imagesFade(0);	
			});
			//cloudMove();
	}
function cloudMove(){
	$(".grLogo").animate({"margin-left":"-400"}, 800, function(){
			$(".grLogo").animate({"margin-left":"-370"}, 800, function(){
					cloudMove();
			});
		});
				
}


function getUrl(page) {
	collapseNav();
	switch(page){
	case "index":
		window.setTimeout('index()', 500);
		break;
	case "portfolio":
		window.setTimeout('portfolio()', 500);
		break;
	case "contact":
		window.setTimeout('contact()', 500);
		break;
	case "services":
		window.setTimeout('services()', 500);
		break;
	default:
		alert("wtf");
		break;
	}
		
}

function index(){
	document.location.href="index.php";
}
function portfolio(){
	document.location.href="portfolio.php";
}
function contact(){
	document.location.href="contact.php";
}
function services(){
	document.location.href="services.php";
}


function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


