	function change(id, newClass) {
		identity=document.getElementById(id);
		if (identity != null)
			identity.className=newClass;
	}
	function changeO(id, newClass) {
		//identity=document.getElementById(id);
		if (id != null)
			id.className=newClass;
	}
	function win_popup(file, name, attribs) {
		window.open (file, name, attribs); 
	}
	
	var WinNum=0;
	function WindowOpen(Url,x,y) {
		var String;
		String =  "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=0,copyhistory=0,";
		String += ",width=";
		String += x;
		String += ",height=";
		String += y;
		WinPic=window.open(Url,WinNum++,String);
		return false;
	}
	
	function hide_sub(name, cell, i) {
		var b = document.getElementById(name);
		if (b != null) {
			b.style.display = 'none';	
		}
	}
	
	function show_sub(name, cell, i) {
		var b = document.getElementById(name);
		if (b != null) {
			b.style.display = '';	
		}
	}

	var galleries = [];
	
	function refreshThumbnailGallery(offset, galleryId)
	{
		var display = '#display_'+galleryId;
		var thumbs = '#thumbs_'+galleryId;
		var descr = '#descr_'+galleryId;
		var thumbRows = galleries[galleryId][0];
		var thumbCols = galleries[galleryId][1];
		var align = galleries[galleryId][2];
		
		// Build the AJAX request	
		$.ajax({
			   type: 'GET',
			   url: 'getthumbs.php',
			   dataType:'html',
			   data:{'align':align, 'rows':thumbRows, 'cols':thumbCols, 'offset':offset, 'gallery_id':galleryId},
			   cache:false,
			   success:function(html){
				   $(thumbs).html(html);
				   $(thumbs+' .gallery_image').bind("click",function(e){
					   var id = $(this).attr('id').substr(6);
					   $(descr).html($('#image_desc_'+id).html());
					   $(display).attr('src',$(this).attr('rel'));
					});
			   }
		});
	}
	
	function verifyField(el, text)
	{
		if (el.value == '') 
		{
			alert(text);
			return false;
		}
		return true;
	}
	
	function verifyContestForm(f)
	{
		if (!verifyField(f.elements['f[FirstName]'], 'Please enter your first name')) return false;
		if (!verifyField(f.elements['f[LastName]'], 'Please enter your last name')) return false;
		if (!verifyField(f.elements['f[Email]'], 'Please enter your email address')) return false;
		if (!verifyField(f.elements['captcha_code'], 'Please enter the word displayed in the image')) return false;
		
		return true;
	}
	

	$(function(){
		var screenw = $(window).width() / 2;
		
		$('#navigation > li').hover(
			function(){
				var left = $(this).offset().left;
				if (left >= screenw)
					$(this).find('ul.flyout:first').css('right', 0);
					
				$(this).find('ul.flyout:first').show();
			},
			function(){ $(this).find('ul.flyout:first').hide(); }
		);
		
		$('ul.flyout > li').hover(
			function() {
				var right = $(this).parent().css('right');
				var className = (parseInt(right) >= 0 ? 'fly-left' : 'fly-right');
				
				if (!$(this).find('ul.flyout:first').hasClass(className))
					$(this).find('ul.flyout:first').addClass(className);
				
				$(this).find('ul.flyout:first').show();
			},
			function() {
				$(this).find('ul.flyout:first').hide();
			}
		);
		
		var w = $('#flash-header').width();
		var h = $('#flash-header').height();
		if (typeof($('#flash-header').attr('rel')) != 'undefined')
			var src = $('#flash-header').attr('rel');
		else
			var src = $('#flash-header a').attr('href');

		var swf = new SWFObject(src, 'flash-header', w, h, '9', 'transparent');
		swf.addParam('wmode','transparent');
		swf.write('flash-header');
	});








	
	
	