
/*------------------------------------------------------------------------------------
* Filename: common.js
* Version: 1.0.0 (2009-12-4)
* Website: www.quayside.com.au
* Author: Tanvir Ahmad (Ronty) & Dhruv Raniga
* Description: Handles layout animations.
    ------------------------------------------------------------------------------------*/


$(document).ready(function(){
		setInterval( "ImageRotation()", 5000 );// Auto image rotation for Home Page.
		Tab();
});


/*-----------------------------------------------------------------------------------------------------------------------------
* Function: Tabs
* Description: Presents Latest and Newsletter panels in tabs
* Author: Tanvir Ahmad
* Date: 20091028
    ---------------------------------------------------------------------------------------------------------------------------*/

function Tab()
{

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$(".tab_content.first").show(); //Show first tab content
	
	//On Click Event
	$(".tabs ul li").click(function() {
		$(".tabs ul li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
	// IF YOU ARE ON REGO PAGE OPEN REGISTER NOW TAB
	var pathname = window.location.hash;
	if((pathname!='') && (pathname=='#register'))
	{
		$(".tabs ul li.register").click();
	}
	
}



/*-----------------------------------------------------------------------------------------------------------------------------
* Function: Main menu fade in out.
* Description: Presents Latest and Newsletter panels in tabs
* Author: Tanvir Ahmad (Ronty)
* Date: 20091028
    ---------------------------------------------------------------------------------------------------------------------------*/
	
	$(function() {
		// set opacity to nill on page load
		$("ul#menu a").append("<span></span>");

		
		$("ul#menu span").css("opacity","0");
		// on mouse over
		$("ul#menu span").hover(function () {
			// animate opacity to full
			$(this).stop().animate({
				opacity: 1
			}, 'fast');
		},
		// on mouse out
		function () {
			// animate opacity to nill
			$(this).stop().animate({
				opacity: 0
			}, 'normal');
		});
	});
	

/*-----------------------------------------------------------------------------------------------------------------------------
* Function: Sliding Boxes
* Description: Presents Apartment boxes
* Author: Sam Dunn
    ---------------------------------------------------------------------------------------------------------------------------*/
	
$(document).ready(function(){
	
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'100px'},{queue:false,duration:320});
				}, function() {
					$(".cover", this).stop().animate({top:'145px'},{queue:false,duration:320});
				});
			});


/*----------------------------------------Start--------------------------------------------------------------------------------
* Function: jQuery ImageRotation
* Description: 
* Author: Tanvir Ahmad (Ronty)
* Date: 20091028
------------------------------------------Start-------------------------------------------------------------------------------*/
 
function ImageRotation()
	{
			
			var ActiveImage = $('DIV#ImageRotation IMG.active');
			var Next=$(ActiveImage).next().length;
			var $IMAGE =  ActiveImage.next().length ? $(ActiveImage).next() : $('DIV#ImageRotation IMG:first');
			
			
			$(ActiveImage).removeClass("active"); //Remove Class Active form Active Image
			$IMAGE.css({opacity: 0.0}) // to New Active Image. Change the Opacity  0 Add Active Class and Remove HideImage Class
			.removeClass("imghide")
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() {
			// During the Opacity Make the Movemake Slow									
					$(ActiveImage).removeClass("active").addClass("imghide");
			});
		
		// Stop Link To go anywhere.
		return false;
	
			
	}


/*-----------------------------------------------------------------------------------------------------------------------------
* Function: IE6 Fonts
* Description: Removes font replacemnt from IE6. If IE8 Don't Replace fond using cufon Funciton. Display Stander 
* Author: 
    ---------------------------------------------------------------------------------------------------------------------------*/

	if(($.browser.msie) && (jQuery.browser.version<=6)){
		// Do Something if IE6
	}
	else
	{ //Else
		Cufon.replace('h1, .tabs ul li');
		
	}
 

