
//var feedback_form_url = 'http://localhost/claryco/clarybusinessmachines/feedback-form/feedback-form.php';
//var feedback_form_url = 'http://www.cbmisb.com/claryco/clarybusinessmachines/feedback-form/feedback-form.php';
var feedback_form_url = 'http://www.clarybusinessmachines.com/feedback-form/feedback-form.php';

function openFeedbackForm(){
	
	var site_name = document.domain;
	var URLStr = feedback_form_url+'?site_name='+site_name+'&referrer='+document.location.href;
	var width = 485;
	var height = 565;
	
	//var left = 50;
	//var top = 50;
	var left = (screen.width/2)-(width/2);
	var top = (screen.height/2)-(height/2);
	
	if(left == undefined){
		left = 100;	
	}
	if(top == undefined){
		top = 50;	
	}
	
	window.open(URLStr, 'FeedbackForm', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

function setRating(rate)
{
	$('#rate_result').fadeOut();
	$('#rating').val('');
	var html_text = 'You rated : ';
	var html_rate = '';    
	if(rate==1){html_rate = '<span style="color:#f20a00;">Bad</span>'; $('#rating').val('Bad');}
	else if(rate==2){html_rate = '<span style="color:#f7866c;">Poor</span>'; $('#rating').val('Poor');}
	else if(rate==3){html_rate = '<span style="color:#fea106;">Good</span>'; $('#rating').val('Good');}
	else if(rate==4){html_rate = '<span style="color:#fac000;">Better</span>'; $('#rating').val('Better');}
	else if(rate==5){html_rate = '<span style="color:#56b845;">Excellent</span>'; $('#rating').val('Excellent');}
	else  {html_rate =''; $('#rating').val('Not Rated');}
	$('#rate_result').html(html_text+html_rate);
	$('#rate_result').fadeIn();
}

function fnGet_Form_Validate()
{
	var bundle_flag = 1;
	var err_message = '';
	
	if($('#Email').val() == '') 
	{
		$('#Email').addClass("text_custom_form_validate");
		err_message = 'Email required.';
		bundle_flag = 0;
	}
	else
	{
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (!filter.test($('#Email').val()))
		{
			$('#Email').addClass("text_custom_form_validate");
			err_message = 'Valid email required.';
			bundle_flag = 0;
		}
		else
		{
			$('#Email').addClass("text_custom_form_success");
		}
	}
	if($('#Comments').val() == '') 
	{
		$('#Comments').addClass("text_custom_form_validate");
		err_message += '<br>Comments required.';
		bundle_flag = 0;
	}
	else
	{
		$('#Comments').addClass("text_custom_form_success");
	}
	
	if(bundle_flag == 0)
	{
		$('#email_valid_div').show();
		$('#email_valid_div').html(err_message);
		return false;
	}
	else
	{
		return true;
		$('#email_valid_div').hide();
	}
	
}
function fnSelfClose()
{
	self.close();	
}

