// JavaScript Document
$(document).ready(function(){  	
	$("#aboutus").load("aboutus.html");	
	
	$("#mainmask").css({
			position:"absolute",
			top:0,
			left:0,
			width: $(window).width(),
			height: $(window).height(),
			opacity:0.8,
			display:"block"
		})
	$("#mainmask,#mainslide").click(function(){
		$("#mainmask").fadeOut(1000);
	});
	
	$(window).resize( function(){
			$("#mask, #mainmask").css({
			width: $(window).width()+100,
			height: $(window).height() + 100
			//display:"block"
		});
	});
	
	
	//register session
	$("#login_signup").live("click",
		function(){
			//showmask();
			$("#clienttxt").fadeOut(1000);
			$("#registertxt").load("register.html").delay(1000).show("slide", {}, 1000);
		});
	
	
	$("#loginsubmit").live("click",
		function(){
			//var u = $("#loginusername").val();
			//alert(u);
			$.ajax( {
			type :"POST",
			url :"get.php",
			data :"type=login"+
				"&username=" + $("#loginusername").val()+ 
				"&password=" + $("#loginpassword").val(),
			success : function(ajaxreturn) {
				if(ajaxreturn=="error")
					$("#loginerrmsg").text("Invalid Login");
				else
					document.location = ajaxreturn;
				}
		});	

	});
	$(".inputtxt").live("click",
		function(){
			$(this).val('');
		});
	
	
	$(".topmenuitem").click(function(){
		$(this).effect("bounce", { times: 3 }, 300);
		
		var name = $(this).attr("id");
		if(name=="biography"){
			showmask();	
			$("#biographytxt").load("bio.html").delay(1000).show("slide", {direction:"down"}, 1000);
		}
		if(name=="service"){
			showmask();
			$("#servicetxt").load("service.html").delay(1000).show("slide", {}, 1000);
		}
		if(name=="contact"){
			showmask();
			$("#contacttxt").load("contact.html").delay(1000).show("slide", {}, 1000);
		}
		if(name=="client"){
			showmask();
			$("#clienttxt").load("login.html").delay(1000).css({top:$(window).height() /2 - 80, left:$(window).width()/2 - 200}).show("slide", {}, 1000);
		}
		if(name=="sample"){
			loadservicepage();
		}
	});
	
	$("#bioclose").live("click",function(){
		$("#biographytxt").fadeOut(1000);
		hidemask();
	});
	$("#serviceclose").live("click",function(){
		$("#servicetxt").fadeOut(1000);
		hidemask();
	});
	
	$("#contactclose").live("click",function(){
		$("#contacttxt").fadeOut(1000);
		hidemask();
	});
	$("#loginclose").live("click",function(){
		$("#clienttxt").fadeOut(1000);
		hidemask();
	});
	
	$("#registerclose").live("click",function(){
		$("#registertxt").fadeOut(1000);
		hidemask();
	});
	
	$("#back").click(function(){
		unloadservicepage();
	});
	
	function unloadservicepage(){
		$("#whitemask,.serviceitem").fadeOut(1000);
	}
	function loadservicepage(){
		$("#whitemask").fadeIn(500);
		
		$(".serviceitem").fadeIn(1000);
	}
	function showmask(){
		$("#mask").css({
			position:"absolute",
			top:0,
			left:0,
			width: $(window).width(),
			height: $(window).height(),
			opacity:0.8
			//display:"block"
		}).fadeIn(1000);
		
	}
	function hidemask(){
		$("#mask").fadeOut(500);
	}
});


/*	
	$("#biography").mouseover(function(){ $(this).css({background:'url(images/biographyover.jpg) no-repeat'}); }).mouseout(function(){$(this).css({background:'url(images/biography.jpg) no-repeat'});});
	$("#sample").mouseover(function(){ $(this).css({background:'url(images/sampleover.jpg) no-repeat'}); }).mouseout(function(){$(this).css({background:'url(images/sample.jpg) no-repeat'});});
	$("#service").mouseover(function(){ $(this).css({background:'url(images/serviceover.jpg) no-repeat'}); }).mouseout(function(){$(this).css({background:'url(images/service.jpg) no-repeat'});});
	$("#client").mouseover(function(){ $(this).css({background:'url(images/clientover.jpg) no-repeat'}); }).mouseout(function(){$(this).css({background:'url(images/client.jpg) no-repeat'});});
	$("#event").mouseover(function(){ $(this).css({background:'url(images/eventover.jpg) no-repeat'}); }).mouseout(function(){$(this).css({background:'url(images/event.jpg) no-repeat'});});
	$("#contact").mouseover(function(){ $(this).css({background:'url(images/contactover.jpg) no-repeat'}); }).mouseout(function(){$(this).css({background:'url(images/contact.jpg) no-repeat'});});
	
	$("#back").mouseover(function(){ $(this).css({background:'url(images/backover.jpg) no-repeat'}); }).mouseout(function(){$(this).css({background:'url(images/back.jpg) no-repeat'});});
	$("#weddingthumb").mouseover(function(){ $("#weddingthumbtxt").css({background:'url(images/weddingover.jpg) no-repeat'}); }).mouseout(function(){$("#weddingthumbtxt").css({background:'url(images/wedding.jpg) no-repeat'});});
	$("#modelthumb").mouseover(function(){ $("#modelthumbtxt").css({background:'url(images/modelingover.jpg) no-repeat'}); }).mouseout(function(){$("#modelthumbtxt").css({background:'url(images/modeling.jpg) no-repeat'});});
	$("#portraitthumb").mouseover(function(){ $("#portraitthumbtxt").css({background:'url(images/portraitover.jpg) no-repeat'}); }).mouseout(function(){$("#portraitthumbtxt").css({background:'url(images/portrait.jpg) no-repeat'});});
	$("#scenarythumb").mouseover(function(){ $("#scenarythumbtxt").css({background:'url(images/scenaryover.jpg) no-repeat'}); }).mouseout(function(){$("#scenarythumbtxt").css({background:'url(images/scenary.jpg) no-repeat'});});
*/
