function toogle_hidden_field(elementId,value) {

	if ($("#"+elementId+" option.INPUTFIELD").val() == value) {
		$("#hiddenField").removeClass("hidden");
		
	} else {
		$("#hiddenField").addClass("hidden");
	}
}

function write_swf(filename,id,width,height,extra) {
	document.write('<object type="application/x-shockwave-flash" data="'+filename+(id!=null?'?cid='+id:'')+'" width="'+width+'" height="'+height+'">');
	document.write('<param name="movie" value="'+filename+(id!=null?'?cid='+id:'')+'" />');
	
	document.write('<param name="quality" value="autohigh" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="menu" value="false" />');
	

	for (i in extra) {
			document.write('<param name="'+extra[i][0]+'" value="'+extra[i][1]+'" />');
	}
	document.write('</object>');
}

/*
function write_flash(filename, width, height, imagepath, paramstr) {
	
	
	document.write("<script type='text/javascript'>");
	document.write("AC_FL_RunContent(");
	document.write("'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',");
	document.write("'width', "+width+",");
	document.write("'height', "+height+",");
	document.write("'src', 'flash/"+filename+"',");
	document.write("'quality', 'high',");
	document.write("'pluginspage', 'http://www.macromedia.com/go/getflashplayer',");
	document.write("'align', 'middle',");
	document.write("'play', 'true',");
	document.write("'loop', 'true',");
	document.write("'scale', 'showall',");
	document.write("'wmode', 'transparent',");
	document.write("'devicefont', 'false',");
	document.write("'id', '"+filename+"',");
	document.write("'bgcolor', 'transparent',");
	document.write("'name', '"+filename+"',");
	document.write("'menu', 'true',");
	document.write("'allowFullScreen', 'false',");
	document.write("'allowScriptAccess','sameDomain',");
	document.write("'movie', 'flash/"+filename+"',");
	document.write("'flashvars', '"+paramstr+"',");
	document.write("'salign', ''");
	document.write(");");
	document.write("</script>");



}
*/
var W3CDOM = (document.createElement && document.getElementsByTagName);

$.fn.renderFileUpload = function() {
	if ($('div.fakefile').size()==0) {
		var fakeFileUpload = document.createElement('div');
		fakeFileUpload.className = 'fakefile';
		fakeFileUpload.appendChild(document.createElement('input'));
		var button = document.createElement('span');
		button.className = 'button';
		fakeFileUpload.appendChild(button);
	} else {
		fakeFileUpload = $('div.fakefile').get(0);
	}

	return this.each(function() {
		if (!W3CDOM) return;
		
		$(this).addClass('hidden');
		
		var clone = fakeFileUpload.cloneNode(true);
		
		this.parentNode.appendChild(clone);
		this.relatedElement = clone.getElementsByTagName('input')[0];
		this.btn = clone.getElementsByTagName('span')[0];
		this.onchange = this.onmouseout = function () {
			this.relatedElement.value = this.value;
		}
		this.onmouseover = function() {
			this.btn.style.backgroundPosition = 'bottom left';
		}
		this.onmouseout = function() {
			this.btn.style.backgroundPosition = 'top left';
		}
	});
}

$(document).ready(function() {
      
	function addMega(){$(this).addClass("hovering");}
	function removeMega(){$(this).removeClass("hovering");}
	
	var megaConfig = {
		interval: 100,
		sensitivity: 4,
		over: addMega,
		timeout: 100,
		out: removeMega
	};
	
	$("li.mega").hoverIntent(megaConfig);
	
	$('#print-btn').click(function(){
		print();
		return false;
	});
  
});




