/* 
-------------------------------------------------------
                                               
	:: squarehead design studio 
	  
	845.331.1953                                   
	www.squarehead.com                             
	sbliss@squarehead.com                          
                                                                                                          
-------------------------------------------------------
                                                     
	DEPENDENCIES
                             
    MooTools                                    
	copyright 2007
	Valerio Proietti, <http://mad4milk.net>
	MIT-style license
                                                     
-------------------------------------------------------
*/

new SmoothScroll();

///////////////////////////////////////////////////////
// Ajax
///////////////////////////////////////////////////////

currentPage = "";

function getPage(page) {
		
	if(currentPage == page) { return; }	
	currentPage = page;	
	$('ajaxTarget').setOpacity(0);
	new Ajax(page, {method: 'get', update: $('ajaxTarget'), evalScripts: false, onComplete: showContent}).request();
}

function showContent(){
	
// --------> show inner content

	fade = new Fx.Style($('ajaxTarget'),'opacity',{
		duration: 1000
	});
	fade.start(1);
	
}


//-----------------------------------------------------
// initialize accordion panels
//-----------------------------------------------------


function initAccordions(){
	if ($$('toggle')){
		aPanels = new Accordion($$('.accToggle'), $$('.accPanel'), {
			duration: 400, 
			alwaysHide: true, 
			start: 'all-closed'
		});
	}
}

//-----------------------------------------------------
// pop up window - centered
// call with: url, name, width, height
//-----------------------------------------------------

function centerPop(url,popName,popWidth,popHeight) {
	var popWidth;
	var popHeight;
	var screenWidth=window.screen.width;
	var screenHeight=window.screen.height;
	var placementx=(screenWidth/2)-((popWidth)/2);
	var placementy=(screenHeight/2)-((popHeight)/2);
	window.open(url,popName,"width="+popWidth+",height="+popHeight+",toolbar=0,location=0,status=0,scrollbars=yes,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
}



//-----------------------------------------------------
// init stuff...
//-----------------------------------------------------

window.addEvent('domready', function(){
	initAccordions();
});


