/*
Project: Gardner Ahlquist
Author: Jason Denizac @ Synoptek
Date: 1/12/2009

Dependencies: jQuery 1.2.6
*/



/* Client-side access to querystring name=value pairs	Version 1.3	28 May 2008	License (Simplified BSD):	http://adamv.com/dev/javascript/qslicense.txt*/
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = {};
	
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);
		
		var value = (pair.length==2)
			? decodeURIComponent(pair[1])
			: name;
		
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
	var value = this.params[key];
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}


/********************* Project Code *********/



jQuery.noConflict(); //make it play nice with DNN... must use "jQuery(...)" rather than "$(...)"

jQuery(document).ready(function(){


/******* hilite local nav links in project view ***********/


var qs = new Querystring();
if (qs.contains("recordid") & qs.contains("Category")){
var selclass = ".gaProjNav"+qs.get("recordid")+"."+qs.get("Category");
jQuery(selclass).addClass("curPage");
}
if (qs.contains("Category")) jQuery("#gaCat"+qs.get("Category")).addClass("curPage");


/******** show all project links in edit mode    ****/
if(jQuery("table.ControlPanel").length != false){
jQuery(".gaHidden").show();
}




/** TextRotator **/
if(jQuery(".gaEditView").length == false){
jQuery("ul#gaTextRotator li:not(:first)").hide();
	function rotate() {
	jQuery("ul#gaTextRotator li").hide();
	jQuery("ul#gaTextRotator li:first").insertAfter("ul#gaTextRotator li:last");
	jQuery("ul#gaTextRotator li:first").fadeIn("slow");
	//$("ul#gaTextRotator li:last").hide(4000, rotate);
};
setInterval(rotate,3000);
}

else{
	jQuery("ul#gaTextRotator").css("overflow","visible");
	jQuery(".gaBlank + .c_footer").css("clear","both");
	jQuery(".gaBlankFooter img").css("float","none");
	jQuery(".gaXmodBtn").show();
	//jQuery(".TextRotatorPane").css("width",400);
}


});