//Main features, enabled with javaScript, used in the site
//which are recalled using document.ready
//www.ashanjaydesigns.com

//delay function
$.fn.delay = function(time, callback){
    // Empty function:
    jQuery.fx.step.delay = function(){};
    // Return meaningless animation, (will be added to queue)
    return this.animate({delay:1}, time, callback);
	}
	

//quick contact box
function quickConBox () {
if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Opera/x.x or Opera x.x (ignoring remaining decimal places);
	   var oprversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	   alert("You're using Opera Browser "  + oprversion + "\nOur Quick Contact form may not work properly with your browser!");
	   //thats right! if you are using broswers other than firefox or chrome, quick contact box doesnt work properly	
		$("p.anchorLink").click(function(){ 
			$("#quickContact span").show();
			$("#quickContact span").animate({opacity: "1.0", top: "-225"}, "250"); 
			$("#qc_bg").show();
			$(this).removeClass("hilite");
			$(this).addID("super");
		});
		
		$("p.anchorLink").hover(function () {
		  $(this).addClass("hilite");
		}, function () {
		  $(this).removeClass("hilite");
		});}
		else {
		$("p.anchorLink").click(function(){ 
			$("#quickContact span").show();
			$("#quickContact span").animate({opacity: "1.0", top: "-225"}, "250"); 
			$("#qc_bg").show();
			$(this).removeClass("hilite");
			$(this).addID("super");
		});
		
		$("p.anchorLink").hover(function () {
		  $(this).addClass("hilite");
		}, function () {
		  $(this).removeClass("hilite");
		});
		}
}	
//Quick contact box closing
function closeU () {
$("#qc_clos").click(function(){
			$("#quickContact span").animate({opacity: "0.0", top: "-200"}, "200");
			$("#quickContact span").delay(300,function(){
				$("#quickContact span").css({display:'none'});
			});
			
		});

}

//Contact me forms
function contactAshanJay(){
	$('.contu_btn').click(function(){
		$('#the_contact').slideToggle('fast');
	});
	
	$('#contact_btn').click(function(){
		$('#the_contact').slideToggle('fast');
	});
	
}

//scroll to the top
function scrollToTop () {
	$('p#to_top a').click(function(){
			$('html, body').animate({scrollTop:0}, 800);
		});
}


// recent updates section
function showmoreup(){
	$('#updatee').css('height')
	$('#nex').hide();
	$('#prev').hide();
	$('#pg3').hide();
	$('#pg4').hide();
	
	//Case -- going to 2 from 1
	$('#smore').click(function(){
		$('#updatee').animate({marginTop: '-240'});
		$(this).hide();
		$('#prev').show();
		$('#pg2').addClass("focus");
		$('#pg1').removeClass("focus");
	});
	$('#pg2').click(function(){
		$('#updatee').animate({marginTop:'-240'});
		$(this).addClass("focus");
		$('#pg1').removeClass("focus");
		$('#prev').show();
		$('#smore').hide();
	});

	//Case 2 -- going to 1 from 2
	$('#prev').click(function(){
		$('#updatee').animate({marginTop: '0'});
		$(this).hide();
		$('#smore').show();
		$('#pg1').addClass("focus");
		$('#pg2').removeClass("focus");
	});	
	$('#pg1').click(function(){
		$('#updatee').animate({marginTop:'0'});
		$(this).addClass("focus");
		$('#pg2').removeClass("focus");
		$('#smore').show();
		$('#prev').hide();
	});
	
}
//very well then, lets load these functions to webpages!