//<![CDATA[

function loadPage() {
	if ( this.id == "dd_artist" && this.value != "-" ) {
		document.location.href = http_base + section + "/performer/" + this.value + "/";
	}
	if ( this.id == "dd_discipline" && this.value != "-" ) {
		document.location.href = http_base + section + "/results/?dd_discipline=" + this.value;
	}
	if ( this.id == "dd_category" && this.value != "-" ) {
		document.location.href = http_base + section + "/results/?dd_category=" + this.value;
	}
}

function printPage() {
	if ( !document.getElementsByTagName ) return false;
	var links = document.getElementsByTagName( "a" );
	for ( var i = 0; i < links.length; i++ ) {
		if ( links[i].className.match( "print" ) ) {
			links[i].onclick = function() {
				if ( window.print ) window.print();
				else alert( "Function not supported. Fonction non supportée." );
				return false;
			}
		}
	}
}

function popupWindow( class_name, width, height ) {
	if ( !document.getElementsByTagName ) return false;
	var links = document.getElementsByTagName( "a" );
	for ( var i = 0; i < links.length; i++ ) {
		if ( links[i].className.match( class_name ) ) {
			links[i].onclick = function() {
				if ( !width && !height ) window.open( this.href, 'popup' );
				else window.open( this.href, 'popup', 'height=' + height + ',width=' + width + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1' );
				return false;
			}
		}
	}
}

function closeWindow( class_name ) {
	if ( !document.getElementsByTagName ) return false;
	var links = document.getElementsByTagName( "a" );
	for ( var i = 0; i < links.length; i++ ) {
		if ( links[i].className.match( class_name ) ) {
			links[i].onclick = function() {
				window.close();
				return false;
			}
		}
	}
}


window.onload = function() {
	if ( document.getElementById( "dd_artist" ) ) document.getElementById( "dd_artist" ).onchange = loadPage;
	if ( document.getElementById( "dd_discipline" ) ) document.getElementById( "dd_discipline" ).onchange = loadPage;
	if ( document.getElementById( "dd_category" ) ) document.getElementById( "dd_category" ).onchange = loadPage;
	popupWindow( 'new_window' );
	popupWindow( 'popup_info', 700, 575 );
	popupWindow( 'popup_contact', 660, 580 );
	closeWindow( 'close' );
	printPage();
}


//]]>
