
function setMenu(obj)
{
	var objid="#"+obj;

	$("ul[class='noul1'] > li").removeAttr("class");
	$("ul[class='noul1'] > li > br").remove();
	$("ul[class='noul1'] > li > a").removeAttr("class");
	$("ul[class='noul1'] > li").removeAttr("style");

	$("ul[class='noul'] > li").removeAttr("class");
	$("ul[class='noul'] > li > br").remove();
	$("ul[class='noul'] > li > a").removeAttr("class");
	$("ul[class='noul'] > li").removeAttr("style");
	
	//if ($(objid + " > a").html().length > 25){
		$(objid).css('backgroundColor', '#f1f1f1');
		
		$(objid).css('border-style', 'solid none');
		$(objid).css('border-color', '#e1e1e1');
		$(objid).css('border-width', '2px');
		

	//	$(objid).attr("class", "menuon1" );
	//}

	//else{
	//	$(objid).attr("class", "menuon" );
	//}

	$(objid + " > a").attr("class", "orng" );


}


function getkey(e)
{
	if (window.event) return window.event.keyCode;
	else if (e) return e.which; else return null;
}


function goodchars(e, goods)
{
	var key, keychar;
	key = getkey(e);
	if (key == null) return true;

	// get character
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	goods = goods.toLowerCase();

	// check goodkeys
	if (goods.indexOf(keychar) != -1)
	return true;

	// control keys
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
	return true;

	// else return false
	return false;
}



function Lclick(obj){
	$(obj).next("p").slideToggle("slow")
	.siblings("p:visible").slideUp("slow");
	$(obj).toggleClass("active");
	$(obj).siblings("h3").removeClass("active");
}





////////////////////Quote///////////////////////////Quote///////////////////////////Quote///////////////////////////



function moveToStep(fromStepNum,toStepNum)
{
	var toStep=document.getElementById('step'+toStepNum);
	var fromStep=document.getElementById('step'+fromStepNum);

	if (stepCheck(fromStepNum)){
		fromStep.style.display='none';
		toStep.style.display='inline';

	}
	else{
		return false;
	}


}


function stepCheck(step)
{
	//return true;

	my_form=document.getElementById('quote');
	
	if (step==1){



	if(document.quote.compName.value=='')
	{
	alert('Please fill your company name.');
	return false;
	}
	if(document.quote.contName.value=='')
	{
	alert('Please fill contact person name.');
	return false;
	}

	if(document.quote.contEmail.value=='' || !validEmail(document.quote.contEmail.value))
	{
	alert('Please fill contact person email correctly.');
	return false;

	}
	if(document.quote.phoneNo.value=='')
	{
	alert('Please fill your phone number.');
	return false;
	}



	return true;

	}
	if (step==2){




	if(document.quote.countryNo.selectedIndex==0)
	{
	alert('Please choose Number of countries.');
	return false;
	}

	var box1 = document.quote.country1.checked;
	var box2 = document.quote.country2.checked;
	var box3 = document.quote.country3.checked;
	var box4 = document.quote.country4.checked;
	var box5 = document.quote.country5.checked;
	var box6 = document.quote.country6.checked;
	var box7 = document.quote.country7.checked;
	var box8 = document.quote.country8.checked;
	var box9 = document.quote.country9.checked;
	var box10 = document.quote.country10.checked;
	var box11 = document.quote.country11.checked;
	var box12 = document.quote.country12.checked;
	var box13 = document.quote.country13.checked;
	var box14 = document.quote.country14.checked;
	var box15 = document.quote.country15.checked;
	var box16 = document.quote.country16.checked;
	var box17 = document.quote.country17.checked;



	var count =(box1 ? 1 : 0)+(box2 ? 1 : 0) + (box3 ? 1 : 0)+ (box4 ? 1 : 0)+ (box5 ? 1 : 0)+ (box6 ? 1 : 0)+ (box7 ? 1 : 0)+ (box8 ? 1 : 0)+(box9 ? 1 : 0) +  (box10 ? 1 : 0) + (box11 ? 1 : 0) + (box12 ? 1 : 0) + (box13 ? 1 : 0) + (box14 ? 1 : 0) + (box15 ? 1 : 0) + (box16 ? 1 : 0) +(box17 ? 1 : 0);



	if(count < document.quote.countryNo.selectedIndex)
	{

	alert('Please choose the '+ document.quote.countryNo.selectedIndex +' countries.');
	return false;

	}


	if(document.quote.surLen.selectedIndex==0)
	{
	alert('Please choose Survey length.');
	return false;
	}

	if(document.quote.quesNo.selectedIndex==0)
	{
	alert('Please choose questions number.');
	return false;
	}

	if(document.quote.respNo.value=='')
	{
	alert('Please fill Number of respondents.');
	return false;
	}

	var box1 = document.quote.age1.checked;
	var box2 = document.quote.age2.checked;
	var box3 = document.quote.age3.checked;
	var box4 = document.quote.age4.checked;
	var box5 = document.quote.age5.checked;




	var count =(box1 ? 1 : 0)+(box2 ? 1 : 0) + (box3 ? 1 : 0)+ (box4 ? 1 : 0)+ (box5 ? 1 : 0);



	if(count == 0)
	{

	alert('Please choose ages.');
	return false;

	}


	var box1 = document.quote.gender1.checked;
	var box2 = document.quote.gender2.checked;


	var count =(box1 ? 1 : 0)+(box2 ? 1 : 0);



	if(count == 0)
	{

	alert('Please choose Gender.');
	return false;

	}


	var box1 = document.quote.nat1.checked;
	var box2 = document.quote.nat2.checked;
	var box3 = document.quote.nat3.checked;
	var box4 = document.quote.nat4.checked;

	var count =(box1 ? 1 : 0)+(box2 ? 1 : 0) + (box3 ? 1 : 0)+ (box4 ? 1 : 0);



	if(count == 0)
	{

	alert('Please choose Nationality.');
	return false;

	}


	if(document.quote.othCrit.value =='')
	{
	alert('Please fill Other criteria.');
	return false;
	}

	if(!document.getElementById('qouta1').checked && !document.getElementById('qouta2').checked){
	alert('Please choose if you want Quota.');
	return false;

	}
	if(document.getElementById('qouta1').checked){

	var box1 = document.quote.qouta_on1.checked;
	var box2 = document.quote.qouta_on2.checked;
	var box3 = document.quote.qouta_on3.checked;
	var box4 = document.quote.qouta_on4.checked;

	var count =(box1 ? 1 : 0)+(box2 ? 1 : 0) + (box3 ? 1 : 0)+ (box4 ? 1 : 0);



	if(count == 0)
	{

	alert('Please choose Quota.');
	return false;

	}


	}

	if(document.quote.irate.selectedIndex==0)
	{
	alert('Please choose Incidence rate.');
	return false;
	}



	return true;

	}
	



}



function uncheck_all_countries()

{
	document.quote.country1.checked=false;
	document.quote.country2.checked=false;
	document.quote.country3.checked=false;
	document.quote.country4.checked=false;
	document.quote.country5.checked=false;
	document.quote.country6.checked=false;
	document.quote.country7.checked=false;
	document.quote.country8.checked=false;
	document.quote.country9.checked=false;
	document.quote.country10.checked=false;
	document.quote.country11.checked=false;
	document.quote.country12.checked=false;
	document.quote.country13.checked=false;
	document.quote.country14.checked=false;
	document.quote.country15.checked=false;
	document.quote.country16.checked=false;
	document.quote.country17.checked=false;

}


function changeCountrNo(obj){
	uncheck_all_countries();
	document.getElementById('contrNo').value=obj.options[obj.selectedIndex].value;

}

function countChoices(obj) {

	var val_d=document.getElementById('contrNo').value;
	//window.alert(obj.name);
	//window.alert(document.quote.num_of_countries.value);

	//var max=document.quote.num_of_countries.value;

	if(val_d=='' || val_d=='0')
	{
		obj.checked = false;
		alert('Choose number of countrier first.');

	}


	var box1 = obj.form['country1'].checked;
	var box2 = obj.form['country2'].checked;
	var box3 = obj.form['country3'].checked;
	var box4 = obj.form['country4'].checked;
	var box5 = obj.form['country5'].checked;
	var box6 = obj.form['country6'].checked;
	var box7 = obj.form['country7'].checked;
	var box8 = obj.form['country8'].checked;
	var box9 = obj.form['country9'].checked;
	var box10 = obj.form['country10'].checked;
	var box11 = obj.form['country11'].checked;
	var box12 = obj.form['country12'].checked;
	var box13 = obj.form['country13'].checked;
	var box14 = obj.form['country14'].checked;
	var box15 = obj.form['country15'].checked;
	var box16 = obj.form['country16'].checked;
	var box17 = obj.form['country17'].checked;



	var count =(box1 ? 1 : 0)+(box2 ? 1 : 0) + (box3 ? 1 : 0)+ (box4 ? 1 : 0)+ (box5 ? 1 : 0)+ (box6 ? 1 : 0)+ (box7 ? 1 : 0)+ (box8 ? 1 : 0)+(box9 ? 1 : 0) +  (box10 ? 1 : 0) + (box11 ? 1 : 0) + (box12 ? 1 : 0) + (box13 ? 1 : 0) + (box14 ? 1 : 0) + (box15 ? 1 : 0) + (box16 ? 1 : 0) +(box17 ? 1 : 0);


	if(count==2)
	{
		var opt=' option';
	}
	else
	{
		var opt=' options';

	}

	if (count > val_d) {
		alert("You can only choose up to "+ val_d + opt);
		obj.checked = false;

	}

}
function more_than_20_min()
{
	//var me=document.quote.survey_length[num];
	var curr=document.quote.surLen.options[document.quote.surLen.selectedIndex].value;


	if(curr==5 || curr==6){

		document.getElementById('more_than_20').innerHTML='<font color="red"><u>Kindly note</u> </font>that we prefer not to commit to surveys longer than 20 minutes. Our policy is to turn down anything above 20 minutes.</font>';
	}
	else
	{
		document.getElementById('more_than_20').innerHTML='';

	}
}
function more_than_40_yaers()
{
	//var curr_4=document.quote.age4;
	var curr_5=document.quote.age6;
	var curr_1=document.quote.age1;
	if(curr_5.checked==true){

		document.getElementById('more_than_40').innerHTML='<font color="red"><u>Kindly note</u> </font>that only around 12% of the population in the Middle East is 45 years or older. We prefer not to commit to quota on the age group 45+.';
	}
	else
	{
		document.getElementById('more_than_40').innerHTML='';

	}
if(curr_1.checked==true){

		document.getElementById('more_less_15').innerHTML='<font color="red"><u>Kindly note</u> </font> that we cannot commit to interviewing youth under the age of 15.';
	}
	else
	{
		document.getElementById('more_less_15').innerHTML='';

	}
}


function no_qouta()
{

	//document.quote.qouta.value

	var checked_2 =document.getElementById('qouta2');

	if(checked_2.checked==true){

		document.quote.qouta_on1.disabled=true;
		document.quote.qouta_on2.disabled=true;
		document.quote.qouta_on3.disabled=true;
		document.quote.qouta_on4.disabled=true;
		document.quote.qouta_on_oth.disabled=true;

	}

	else
	{
		document.quote.qouta_on1.disabled=false;
		document.quote.qouta_on2.disabled=false;
		document.quote.qouta_on3.disabled=false;
		document.quote.qouta_on4.disabled=false;
		document.quote.qouta_on_oth.disabled=false;
	}
}
function checkOther(){
	my_form=document.getElementById('quote');
	if (document.getElementById('qouta_on_oth').value==''){
		document.quote.qouta_on4.checked=false;

	}
	else{
		document.quote.qouta_on4.checked=true;
	}


}




function submitvalid(){

	my_form=document.getElementById('quote');

	if(!document.getElementById('develop1').checked && !document.getElementById('develop2').checked){
		alert('Please answer question one.');
		return false;

	}

	if(!document.getElementById('translate1').checked && !document.getElementById('translate2').checked){
		alert('Please answer question two.');
		return false;

	}

	if(!document.getElementById('program1').checked && !document.getElementById('program2').checked){
		alert('Please answer question three.');
		return false;

	}
if (document.getElementById('program1').checked){
	if(!document.getElementById('Excel1').checked && !document.getElementById('Excel2').checked){
		alert('Please answer question four.');
		return false;

	}

	if(!document.getElementById('analys1').checked && !document.getElementById('analys2').checked){
		alert('Please answer question five.');
		return false;

	}



}

	document.quote.submit();




}

function checkQ3(status){
	
	qth=document.getElementById('q3');
	qthan=document.getElementById('q3an');
	
	if (status=='1'){
		$('#q3').hide();
		$('#q3an').hide();
		//qth.style.display='none';
		//qthan.style.display='none';
	}
	else{
		$('#q3').show();
		$('#q3an').show();
		//qth.style.display='block';
		//qthan.style.display='block';
	}
}










function checkQ(Q,status){
	
	qth=document.getElementById('q'+Q);
	qthan=document.getElementById('q'+Q+'an');
	
	if (status=='1'){
		$(qth).hide();
		$(qthan).hide();
		//qth.style.display='none';
		//qthan.style.display='none';
	}
	else{
		$(qth).show();
		$(qthan).show();
		//qth.style.display='block';
		//qthan.style.display='block';
	}
}