	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);
	}
	
	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(f,msg)
	{
		if (f.value == '') 
		{
			alert(msg);
			return false;
		}
		return true;
	}
	
	function verifyRadio(f,msg)
	{
		if ($('input:radio[name='+f+']:checked').length == 0)
		{
			alert(msg);
			return false;
		}
		return true;
	}
	
	function verifyInfoForm(f)
	{
		if (!verifyField(f.name,'Please enter your name')) return false;
		if (!verifyField(f.city,'Please enter your city')) return false;
		if (!verifyField(f.state_prov,'Please enter your state/province')) return false;
		if (!verifyField(f.country,'Please enter your country')) return false;
		if (!verifyField(f.email,'Please enter your email address')) return false;
		if (!verifyField(f.phone_areacode,'Please enter the area code of your phone number')) return false;
		if (!verifyField(f.phone,'Please enter your phone number')) return false;
		
		if (!verifyRadio('application', 'Please choose an option under Application of Equipment')) return false;
		if (!verifyRadio('location_aqcuired', 'Please specify if a location has been acquired')) return false;
		if (!verifyRadio('plan_available', 'Please specify if you have a site plan available')) return false;
		if (!verifyRadio('indoor_outdoor', 'Please specify if the application is indoor or outdoor')) return false;
		if (!verifyRadio('budget', 'Please specify your budget')) return false;
		
		if (f.how_did_you_hear.value == '' && f.how_did_you_hear_other.value == '')
		{
			alert('Please specify how you heard about International Play Co.');
			return false;
		}
		return true;
	}
	
	function floating_navigation(page_id,menu_id) {
//		Obj = document.getElementById('floating_navigation');
//		Obj.style.display = 'block';
		
		qstr = '&page_id='+ page_id;
		if (typeof(menu_id) != 'undefined')
		{
			qstr += '&menu_id='+menu_id;
			file = 'includes/display/navigation_submenu.inc.php';
		}
		else
		{
			file = 'includes/display/navigation_sub.inc.php';
		}
		
		ajax_call('floating_navigation',file,'',qstr,'');
	}
	
	function ajax_call(return_to,run_function,run_after, params, f) {
	
		var container = null;
		if (typeof(return_to) != 'object') 	
			container = document.getElementById(return_to);		
		else container = return_to;
	
	
	if (return_to != '' && typeof(container) == 'object') {
		$(container).empty();
		$(container).addClass('loading');
	} 
	
	$.ajax({
		  url: run_function +"?ran=" + Math.random() + params,
		  cache: false,
		  success: function(html){
			//console.log('success');
			if (container != null) {
				$(container).html(html);
				if ( return_to != '' ) {
					$(container).removeClass('loading');
					$(container).show();
				} 
			}
			
			if (container == null && typeof(f) == 'function') {
				f();
			} else if (container != null && typeof(f) == 'function') {
				$(container).ready( function() { f(); } );
			}			

			
		  },
		  error: function (XMLHttpRequest, textStatus, errorThrown) {
			  // typically only one of textStatus or errorThrown 
			  // will have info
			  this; // the options for this ajax request
			  alert('ajax error: ' + error_thrown + textStatus);
			}
	});
	
}