// JavaScript Document
$(function(){
	jqExpr  = 'form[name=REG_Form_AR] select[name!="Title"][name!="C_Country"],';
	jqExpr += 'form[name=REG_Form_EN] select[name!="Title"][name!="C_Country"],';
	jqExpr += 'form[name=REG_Form_ES] select[name!="Title"][name!="C_Country"],';
	jqExpr += 'form[name=REG_Form_FR] select[name!="Title"][name!="C_Country"],';
	jqExpr += 'form[name=REG_Form_HU] select[name!="Title"][name!="C_Country"],';
	jqExpr += 'form[name=REG_Form_IT] select[name!="Title"][name!="C_Country"],';
	jqExpr += 'form[name=REG_Form_GR] select[name!="Title"][name!="C_Country"],';
	jqExpr += 'form[name=REG_Form_NL] select[name!="Title"][name!="C_Country"],';
	jqExpr += 'form[name=REG_Form_TR] select[name!="Title"][name!="C_Country"],';
	jqExpr += 'form[name=REG_Form_RU] select[name!="Title"][name!="C_Country"]';
	$( jqExpr )
		.each(function(){
				$cbox	= $(this).closest('tr').prev().prev(':has(input[type=checkbox])').find('input').removeAttr('checked');
				$(this).data('cbox', $cbox);
				$cbox.data('smenu', $(this))
					.click(function(){
							if( $(':checked', $(this)).size() < 1 ){
								$cbox.data('smenu').children('option').removeAttr('selected').filter('value=""').attr('selected', 'selected');
							}
						});
			})
		.change(function(){
				$cbox	= $(this).data('cbox');
				if( '' == $(this).val() ){
					$cbox.removeAttr('checked');
				}else{
					$cbox.attr('checked', 'checked');
				}
			});


	$('table.tab-nav-hdr > tbody > tr > td').hover(
		function(){
			$(this).addClass('tab-nav-hdr-on');
		},
		function(){
			$(this).removeClass('tab-nav-hdr-on');
		}
	);
	$('table.left-nav > tbody > tr > td').hover(
		function(){
			$(this).addClass('left-nav-on');
		},
		function(){
			$(this).removeClass('left-nav-on');
		}
	);
});
function is_checked( p ){
	return ($('input[name="' + p + '"]:checked').size() > 0);
}
function is_empty( v ){
	$v	= $('input[name="' + v + '"]');
	if($v.size() < 1){
		return true;
	}
	if($v.val().length < 1){
		return true;
	}
	return false;
}
function is_selected( v ){
	$v	= $('select[name="' + v + '"]');
	if($v.size() < 1){
		return true;
	}
	if($v.val().length < 1){
		return true;
	}
	return false;
}
function is_email( v ){
	v	= $('input[name="' + v + '"]').val();
	var regex = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	return regex.test(v);
}
