$(function() {
	$("#registration").validate();
	$("input[type=text]").each(function(){
		$(this).bind("keyup blur", function(){
			if ($(this).val() != ""){
				$(this).prev("label").hide();
			} else {
				$(this).prev("label").show();
			};
		});
	});
	$("#customer #video").click(function(){
		if ($.browser.msie) {
			$("select").hide();
		};
		$("#videoPlaceHolder").addClass("cb_showing");
		$("#videoPlaceHolder a").media({width:640, height:498, caption:false});
		$(this).colorbox({inline:true, href:'#videoPlaceHolder', open:true});
		if(pageTracker){
			pageTracker._trackPageview('/ten/viewed-customer-video.html');
		};
	});
	$("#prospect #video").colorbox({href:'http://multimedia.mapinfo.com/intro_to_li.html',iframe:true,fixedWidth:'620',fixedHeight:'450'});
	$("#modalClose,#modalBackgroundOverlay").click(function(){$("select").show();});
	$("input,select,label").focus(function(){
		$("select").show();
	});
	$("#Country").each(function(){
		$.ajax({	// Load Country element
			url: '../scripts/php/Ajax_List.php',
			type: 'POST',
			data: 'request=getCountryList',
			dataType: 'html',
			error: function(){
				alert('Error retrieving the country list');
			},
			success: function(data){
				$('#Country').append(data);
			}
		});
	});
	
	$("#Industry").each(function(){
		$.ajax({	//Load Industry element
			url: '../scripts/php/Ajax_List.php',
			type: 'POST',
			data: 'request=getIndustryList',
			dataType: 'html',
			error: function() {
				alert('Error retrieving the industry list');
			},
			success: function(data) {
				$('#Industry').append(data);
			}
		});
	});
	$('#Country').change(function() {	//Load State Province field upon country change
		$.ajax({
			url: '../scripts/php/Ajax_List.php',
			type: 'POST',
			data: 'request=getCountryStateList&ctry=' + $(this).val(),
			dataType: 'html',
			error: function(){
				alert('Error retrieving the country state list');
			},
			success: function(data){
				$('#StateProvince').html(data);
			}
		});
	});
	$("a.popup").click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
});