// JavaScript Document
function get(id){
	return document.getElementById(id);
}
function checkext(str, id, list){
	/*var oas = new ActiveXObject("Scripting.FileSystemObject");
	var e = oas.getFile(str);
	var f = e.size;
	alert(f/1000 + "Kb");*/
	
	if(str>''){
		if(in_string(str.substring(str.length,str.length-4), list)==false){
			get('file'+id+'_c').style.display='inline';
			get('file'+id).value = '';
			return;
		}
	}
	get('file'+id+'_c').style.display='none';
}
function in_string(value, list){
	var mySplitResult = list.split(",");
	
	for(i = 0; i < mySplitResult.length; i++){
		if(mySplitResult[i]==value){
			return true;
		}
	}
	return false;
}
function toggle(id, id2){
	var box = document.getElementById(id);
	var box2 = document.getElementById(id2);
	if(box){
		if(box.style.display=='none'){
			box.style.display = 'inline';
		}else{
			box.style.display = 'none';
		}
	}
	if(box2){
		if(box2.style.display=='none'){
			box2.style.display = 'inline';
		}else{
			box2.style.display = 'none';
		}
	}
}

function preview(url){
	window.popupWindow(url,'preview',600,600,'directories=yes,status=yes,resizable=yes,scrollbars=yes,location=1,menubar=yes,left=0,top=0');
}
function popupWindow(url, windowName, width, height, customparameters)
{
	//Determine the browser if positioning of pop-up window is supported
	theversion=navigator.appVersion.substring(0,3);
	
	if (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) == '4')
	{
		X = screenX + myscreen(outerWidth-width)/2;
		myscreenY = screenY + (outerHeight-height)/2;
	}
	else
	{
		//IE & Nav3 don't do positioning, variables just have to exist...
		myscreenX = 0;
		myscreenY = 0;
	}
	
	if (customparameters)
	{
		windowparams = customparameters
	}
	else
	{
		windowparams = "directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no"
	}
	
	//Default window name if not passed to function
	if (!windowName)
	{
		windowName = "popup_window";
	}
	
	popupWindowObj = window.open(url, windowName, "toolbar=no,width=" + width + ",height=" + height + ",screenX=" + myscreenX + ",screenY=" + myscreenY + "'," + windowparams) ;
	popupWindowObj.focus() ;
}

window.addEvent('domready', function() {
	//create our Accordion instance
	var myAccordion = new Accordion($('accordion'), 'li.toggler', 'div.element', {
		opacity: false,
		onActive: function(toggler, element){
			//toggler.setStyle('background', 'green');
			toggler.setStyle('background', '#DEDFDE');
		},
		onBackground: function(toggler, element){
			toggler.setStyle('background', '#F7F7F7');
		}
	});
									 });