/**
 * @author Mery
 */

function initAccordionWidthProp(divName, toggler, totoggle, mydisplay){
	//		alert(divName+'-'+toggler+'-'+totoggle);
	//create our Accordion instance
	var myAccordion = new Accordion($(divName), toggler, totoggle, {
		opacity: false,
		onActive: function(toggler, element){
		
			//toggler.setStyle('color', '#41464D');
		
		},
		onBackground: function(toggler, element){
			//toggler.setStyle('color', '#528CE0');
		},
		initialDisplayFx : false, 
		display : mydisplay
		
	
	});
}
function initAccordion(){
	if($('accordion1')){ initAccordionWidthProp('accordion1', 'h3.toggler1', 'div.element1', $('history1').value);}
	if($('accordion2')){ initAccordionWidthProp('accordion2', 'h3.toggler2', 'div.element2', $('history2').value);}
	
}
function updateHistory(myHistory, myValue){
	$('history'+myHistory).value = myValue;
	url = '../sql/updateHistory.sql.php';
	target = 'feedback';
	var request_R = new Request.HTML({
		url: url,
		update: target,
		onComplete: function(tree, elements, html, js){
		}
	});
	request_R.post({
		'history': myHistory,
		'value': myValue
	});
}
function externalLinks() {
 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.target = "_blank";
 }
}
window.onload = externalLinks;

