/*------------------------------------------------------------------------------------
* Filename: common.js
* Version: 1.0.0 (2011-03-07)
* Website: lda.act.gov.au/?/foreshore
* Author: Paul Semczuk
* Description: Handles site ready state and common operations
    ------------------------------------------------------------------------------------*/

$(document).ready(function() {
	// FAQs
	faqQuestionAnswer();
	
	// Lightbox
	$('.lightbox-photos a').lightbox({
		fileLoadingImage: '/resources/images/lightbox/loading.gif',
		fileBottomNavCloseImage: '/resources/images/lightbox/closelabel.gif'
	});
	
	// Default value clear
	$('.form-input').focus(function() {
		if (this.value == this.defaultValue) {
			this.value = '';
		}
	}).blur(function() {
		if (this.value == '') {
			this.value = this.defaultValue;
		}
	});
	
	// Hot Spot Slideshow
	$('.hot-spot-slides').cycle({
		delay: 1000,
		fx: 'fade',
		pager: '#hot-spot-nav',
		pagerAnchorBuilder: function(idx, slide) {
			var dig = ['one', 'two', 'three'];
			return '<div class="hot-spot-link hot-spot-link-' + dig[idx] + '">' + $('.hot-spot-blink-' + dig[idx]).html() + '</div>';
		},
		pause: true,
		pauseOnPagerHover: true,
		pagerEvent: 'mouseover',
		timeout: 6500
		/* Cycle < v2.99 page link active bug fix
		updateActivePagerLink: function(pagerContainer, slideidx, activeClass) {
			var dig = ['one', 'two', 'three'];
			$(pagerContainer + ' div.hot-spot-link').removeClass(activeClass);
			$(pagerContainer + ' div.hot-spot-link-' + dig[slideidx]).addClass(activeClass);
		}*/
	});
  
	// Remove nav templates
	$('#hot-spot-nav-build').remove();
});

//function startSlide(r) {
//	if (!r)
//		setTimeout(function() {startSlide(true)}, 1000);
//	else
//		$('.hot-spot-slides').cycle();
//}
//
//function pauseSlide() {
//	$('.hot-spot-slides').cycle('pause');
//}
//
//function gotoSlide(sl) {
//	$('.hot-spot-slides').cycle('pause').cycle(sl);
//}


/*----------------------------------------Start--------------------------------------------------------------------------------
* jQuery FAQ Question/Answer
* Function: jQuery FAQ Question/Answer
* Description: 
* Author: Tanvir Ahmad (Ronty)
* Date: 20091028
------------------------------------------Start-------------------------------------------------------------------------------*/	
function faqQuestionAnswer() {
	$('.answer').hide();
	$('.question').click(function(){
		$(this).next('.answer').slideToggle();
		return false;
	});
}
/*----------------------------------------End--------------------------------------------------------------------------------
*  jQuery FAQ Question/Answer
------------------------------------------End-------------------------------------------------------------------------------*/

/*
=======
*/
function playVideo(  )
{
	if ($("#videoPlayer").length)
	{
		var title = $("#videoPlayer").attr("title");
		var flashvars = {
		  VID: "/resources/templates/kingstonforeshore/videos/"  + title + ".flv",
		  PIC: "/resources/templates/kingstonforeshore/images/videos/" + title + ".jpg"
		};
		var params = {
			menu: "false",
			allowfullscreen: "true",
			allowScriptAccess: "always",
			wmode: "transparent"
		};
		var attributes = {
		};
		
		swfobject.embedSWF("/resources/templates/kingstonforeshore/flash/player.swf", "videoPlayer", "478", "300", "8.0.0","expressInstall.swf", flashvars, params, attributes);
		}
	}

	/*
	var flashvars = {
	  VID: "http://lda.greycanberradev.com/resources/templates/kingstonforeshore/videos/Colin.flv",
	  PIC: "http://lda.greycanberradev.com/resources/templates/kingstonforeshore/images/videos/collin.jpg"
	};
	var params = {
		menu: "false",
		allowfullscreen: "true",
		allowScriptAccess: "always",
		wmode: "transparent"
	};
	var attributes = {
	};
	
	swfobject.embedSWF("http://lda.greycanberradev.com/resources/templates/kingstonforeshore/flash/player.swf", "videoPlayer", "478", "300", "8.0.0","expressInstall.swf", flashvars, params, attributes);
*/
/*----------------------------------------Start--------------------------------------------------------------------------------
* Flash
* Function:  Flash
* Description: 
* Author:
* Date: 
------------------------------------------Start-------------------------------------------------------------------------------*/	
/*
$('.videoplayer').click(function(){
	var rel = $(this).attr('href');
	if (rel.indexOf('../') < 0) {
		rel = "../"+rel;
	}
	var into = $(this).parents('p:first');
	$('a',into).hide();
	$(into).flash({
			src: 'resources/templates/kingstonforeshore/resources/flash/player.swf?VID='+rel,
			width: 240,
			height: 165,
			flashvars: { VID: rel }
		},{ version: 8 },function(htmlOptions) {
			var $this = $(this);
			htmlOptions.wmode = 'opaque';
			htmlOptions['class'] = 'vidplayer';
			$this.prepend($.fn.flash.transform(htmlOptions));
		}
	);
	
	return false;
});	
*/
/*----------------------------------------End--------------------------------------------------------------------------------
*  jQuery FAQ Question/Answer
------------------------------------------End-------------------------------------------------------------------------------*/

