// JavaScript Document
function show_hide(id)
{
	sub_div=document.getElementById(id).style;
	//alert(sub_div.display);
	if(sub_div.display=='block')
	{
		//sub_div.display='none';
		$("#"+id).animate({height: "hide"}, 500)
	}
	else
	{
		$("#"+id).animate({height: "show"}, 500)
	//	sub_div.display='block';
	}
}
//////////////////////////////
function show_sub(id)
{
document.getElementById(id).style.visibility='visible';
//	$("#"+id).animate({height: "show"}, 5)
}
///////////////////////////
function hide_sub(id)
{
//setTimeout("document.getElementById('"+id+"').style.visibility='hidden'",100);
document.getElementById(id).style.visibility='hidden';
//		$("#"+id).animate({height: "hide"}, 1)

}
//////////////////
function exchange(name)
{
	document.getElementById('arm').style.display='none';
	document.getElementById('usa').style.display='none';
	document.getElementById('euro').style.display='none';
    if(navigator.appName == "Microsoft Internet Explorer")
	  {
		  document.getElementById(name).style.display='block';
	  }
	  else
	  {
		  document.getElementById(name).style.display='table-row';
	  }
//alert(document.getElementById(name).style.display);
}
///////////////////
function open_file(file)
{
 
  document.getElementById("ttt").innerHTML="<img src='images/loading.gif' width='200' height='100' />";
$.get(
  file,
  {
    type: "test-request",
    param1: "param1",
    param2: 2
  },
  onAjaxSuccess
); 
}
function onAjaxSuccess(data)
{
  document.getElementById("ttt").innerHTML=data;
}

function open_file1(file)
{
$.get(
  file,
  {
    type: "test-request",
    param1: "param1",
    param2: 2
  },
  onAjaxSuccess1
);
}
function onAjaxSuccess1(data)
{
  document.getElementById("flash").innerHTML=data;
}

/////////////////////////////
function FormClick (form_id,file) {
	
  var str = $("#"+form_id).serialize();
  $.post(file, str, function(data) {
  document.getElementById("ttt").innerHTML=data;
  });
  document.getElementById("ttt").innerHTML="<img src='images/loading.gif' width='200' height='100' />";
}

function ajax_post(form_id,file) {
	
  var str = $("#"+form_id).serialize();
  $.post(file, str, function(data) {
  document.getElementById("ttt").innerHTML=data;
  });
  document.getElementById("ttt").innerHTML="<img src='images/loading.gif' width='200' height='100' />";
}
////////////////////
function show_calendar(name)
{
	cal1x.select( document.getElementById(name),name,'dd.MM.yyyy');
return false;
}

function selected()
{
	document.name_to.select_to.options[0].selected=true; 
	document.name_from.select_from.options[0].selected=true;
}
///////////////////
function tt_calc(form)
{
	var days_count;
	var guid_days;
	var guid_price;
	var piple_count;
	var all_tours_price;
	var hotel_price;
	var meeting_price;
	var see_off_price;
	var min_shauyt;
	var tokos;
	tokos = form.min_shauyt_tokos.value;
	days_count=form.days_count.value;
	guid_price=form.guide.value;
	
	guid_days=0;
	for(i=1;i<=days_count;i++)
	{
		if(eval("form.guid_"+i+"[0].checked"))
		{
			guid_days++;
		}
	}
	
	piple_count=form.adults.selectedIndex+form.children.selectedIndex+1;
	
	all_tours_price=0;
	for(i=1;i<=days_count;i++)
	{
		if(piple_count>2)
		{
			all_tours_price+=parseInt(eval("form.bus_"+(eval("form.day_"+i+".selectedIndex")+1)+".value"));
		}
		else
		{
			all_tours_price+=parseInt(eval("form.car_"+(eval("form.day_"+i+".selectedIndex")+1)+".value"));
		}
	}
///////hotel category start
	var star=0;
	for(i=0;i<5;i++)
	{
		if(form.hotel_category[i].checked)
		{
			star=i+1;
			break;
		}
	}
///////hotel category end
//////////////////////////
////////start hotel
	hotel_price=0;

	if(form.h_board.checked)
	{
		hotel_price+=parseInt(eval("form.s"+star+"_half.value"));
	}
	if(form.f_board.checked)
	{
		hotel_price+=parseInt(eval("form.s"+star+"_full.value"));
	}

	hotel_price+=(parseInt(eval("(form.s"+star+"_room1.value)*(form.h_room_1.selectedIndex)"))+parseInt(eval("(form.s"+star+"_room2.value)*(form.h_room_2.selectedIndex)"))+parseInt(eval("(form.s"+star+"_room3.value)*(form.h_room_3.selectedIndex)")))*days_count;

////////end hotel	
///////
////////////dimavore chanaparhel
	meeting_price=0;
	if(form.meeting.checked)
	{
		if(piple_count > 2)
			meeting_price=parseInt(form.dimavorel_bus.value);
		else 
			meeting_price=parseInt(form.dimavorel_car.value);
	}
	
	see_off_price=0;
	if(form.see_off.checked)
	{
		if(piple_count > 2)
			see_off_price=parseInt(form.uxarkel_bus.value);
		else 
			see_off_price=parseInt(form.uxarkel_car.value);
	}
//////////////
many=all_tours_price+(guid_days*guid_price)+hotel_price+meeting_price+see_off_price;

if((many/10)<parseInt(form.min_shauyt.value))
{
	many+=parseInt(form.min_shauyt.value);
}
else
{
	many+=(many/10);
}

return "Total Price for Your Own Planned Tour is "+many+"  AMD";	
	//document.getElementById('prs').innerHTML="Total Price for Your Own Planned Tour is "+many+"  AMD";					
}
//////////
function select_room(form)
{
	piple_count=form.adults.selectedIndex+form.children.selectedIndex+1;
	
	room_3=parseInt(piple_count/3);
	form.h_room_3.selectedIndex=room_3;
//	alert(room_3);
	room_2=parseInt(piple_count%3);
	if(room_2==2)
	{
		form.h_room_2.selectedIndex=1;
		form.h_room_1.selectedIndex=0;
	}
	else if(room_2==1)
	{
		form.h_room_1.selectedIndex=1;
		form.h_room_2.selectedIndex=0;
	}
	else
	{
		form.h_room_1.selectedIndex=0;
		form.h_room_2.selectedIndex=0;
	}	
}

function tailor()
{
	window.open('teilor.php','_blank','scrollbars,height=600,width=500,status=yes,toolbar=no,menubar=yes,location=no,margin=0,padding=0');	
}
function zoom(url)
{
	window.open('teilor.php');
}

function clean(name)
{
	if(name.value=="search") 
	name.value="";
}
function writ(name)
{
	if(name.value=="") 
	name.value="search";
}
function kanvertor()
{
	//alert(document.exchange.usa_excheng.value);	
	select1=document.exchange.select_1;
	select2=document.exchange.select_2;
	convert=document.exchange.text_convert;
	result=document.exchange.text_result;
	usa=document.exchange.usa_excheng;
	eur=document.exchange.eur_excheng;
	//alert(select1.value);
	if(select1.value=="amd_1")
	{	
		if(select2.value=="amd_2")
		result.value=convert.value;	
		else if(select2.value=="usa_2")
		result.value=parseInt(convert.value)/parseInt(usa.value);
		else if(select2.value=="eur_2")
		result.value=parseInt(convert.value)/parseInt(eur.value);
	}
	else if(select1.value=="usa_1")
	{	
		if(select2.value=="amd_2")
		result.value=parseInt(convert.value)*parseInt(usa.value);
		else if(select2.value=="usa_2")
		result.value=convert.value;
		else if(select2.value=="eur_2")
		result.value=parseInt(convert.value)*parseInt(usa.value)/parseInt(eur.value);
	}
	else if(select1.value=="eur_1")
	{	
		if(select2.value=="amd_2")
		result.value=parseInt(convert.value)*parseInt(eur.value);
		else if(select2.value=="usa_2")
		result.value=parseInt(convert.value)*parseInt(eur.value)/parseInt(usa.value);
		else if(select2.value=="eur_2")
		result.value=convert.value;
	}
}
///////////////////
