/* GENERAL FUNCTIONS */
/* Dependencies : jquery-1.2.6.min.js*/

 


/* SHADOWBOX */
/*
Shadowbox.loadSkin('classic', 'js/shadowbox_skin'); // use the "classic" skin
$(window).load(function(){

	var options = {
	handleOversize:'drag',
	//displayNav:false,
	handleUnsupported:'remove'
	};
		
	Shadowbox.init(options);
});

*/


CwsExpandableArea = {
	createExpandLinks: function() {
		var expandLinks = document.createElement('a');
		expandLinks.setAttribute('href', 'javascript:void(0);');
		expandLinks.setAttribute('class', 'moreDetails');
		expandLinks.setAttribute('title', 'More details');
		var linkText = document.createTextNode('More details');
		expandLinks.appendChild(linkText);
		$('.extendedInfo').after(expandLinks);
	},

	applyClickHandlers: function() {
		$('.moreDetails').click(function() {
			if($( this ).prev('.extendedInfo').css('display') == 'block'){
				$( this ).text("More details").attr({'title': 'More details'}).toggleClass('moreClose');
				} else {
				$( this ).text("Hide details").attr({'title': 'Hide details'}).toggleClass('moreClose');
			}
			$( this ).prev('.extendedInfo').slideToggle();
			$( this ).blur();return false;
		});
	},
	setup: function(){
		CwsExpandableArea.createExpandLinks();
		CwsExpandableArea.applyClickHandlers();
	}
}


CwsNewWindow = {
	newWin: function(){//open links with rel external in new window
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
			anchor.getAttribute("rel") == "external"){
			anchor.title += " (This link opens in a new window)";
			anchor.onclick = function(){
				open(this.href);
				return false;
				}
			}
		}
	}
}

 $(document).ready(function() {
	$(document.body).addClass('hasJs');/*apply js class to body to target js centric styling*/
	CwsExpandableArea.setup();
	CwsNewWindow.newWin();
 });
