
function refresh_parent()
{
	var turquoise_window = window.top.turquoise;

	if( turquoise_window.frames['viewed'] )
		turquoise_window.frames['viewed'].location.reload();
	//turquoise_window.frames['saved'].location.reload();
}

function saved_system( )
{
	var turquoise_window = window.top.turquoise;

	turquoise_window.location.href = '/saved';

	turquoise_window.focus();
}

function change_offer( offer, Special_date, request_type  )
{
	//if( offer.selectedIndex > 0 )
	//{
		location.href = '/special-offers/' + offer.options[ offer.selectedIndex ].value + '/' + Special_date + '/' + request_type;
	//}
}

function change_offerdate( offer, date, request_type )
{
	//if( offer.selectedIndex > 0 )
	//{
	  location.href = '/special-offers/' + offer + '/' + date.options[ date.selectedIndex ].value + '/' + request_type;
	//return date.options[ date.selectedIndex ].value;
	//location.href = '/special/' + date.options[ date.selectedIndex ].value + '/';
	//}
}

function quote( type, id )
{
	var turquoise_window = window.top.turquoise;

	turquoise_window.location.href = '/quote.asp?system=quote&type='+type+'&item='+id;

	turquoise_window.focus();
}

function offer_quote( country, holiday )
{
	var turquoise_window = window.top.turquoise;

	//holiday.replace(/\#.*$/, '');
	
	turquoise_window.location.href = '/holidayquote.asp?system=quote&'+escape(country)+'=y&holiday='+escape(holiday);

	turquoise_window.focus();
}

function save_item( type, id )
{
	var turquoise_window = window.turquoise;

	var url;

	url = "/viewsaved.asp?type=";

	if( type )
		url += "hotel";
	else
		url += "journey";

	url += "&id="+id;

	turquoise_window.frames['saved'].location.href = url;
}

function open_holiday( parent, section, type, id )
{
	var turquoise_window = window.top.turquoise;
	var url;

	url =  "/holiday.asp?system=";

	if( type == "1" )
	{
		url += "hotel";
	}
	else
	{
		url += "journey";
	}
	url += "&action=list";
	url += "&parent=" + parent;
	url += "&id=" + section;

	if( type == "1" )
	{
		open_hotel( id );
	}
	else
	{
		open_journey( id );
	}

	turquoise_window.location.href = url;
}

function open_help()
{
	var help = window.open('/help/howtobook.htm', 'help', 'width=344,height=500,scrollbars=yes');

	help.focus();
}

function viewed_popup()
{
	var view_popup	= window.open('/viewedpopup.asp', 'viewed6', 'width=340,height=218,scrollbars=no,toolbar=no,status=no,menubar=no,');

	view_popup.focus();
}

function survey_terms_popup()
{
	var terms_popup	= window.open('/surveyterms.html', 'surveyterms', 'width=340,height=218,scrollbars=no,toolbar=no,status=no,menubar=no,');

	terms_popup.focus();
}

function all_contributions_popup()
{
	var terms_popup	= window.open('/secure/includes/all_contributions.asp', 'allcontributions', 'width=665,height=257,scrollbars=yes,toolbar=no,status=no,menubar=no,');

	terms_popup.focus();
}


function open_news( id )
{
	var news	= window.open('/pages/news/'+id, 'news', 'scrollbars=yes,width=490,height=550');

	 news.focus();
}

function open_shop( id )
{
	var shop = window.open('/pages/shop/'+id, 'shop', 'scrollbars=no,width=352,height=550');

	 shop.focus();
}


function open_tour_preview( id )
{
	var tour	= window.open('/pages/vtours/'+id+'/'+id+'.htm', 'tour', 'scrollbars=yes,width=570,height=320');

	 tour.focus();
}

function open_offer( id )
{
	var offer	= window.open('/pages/offers/'+id+'.htm', 'offer', 'scrollbars=yes,width=518,height=520');

	 offer.focus();
}

function open_map( name )
{
	//if( name == "5" ||  name == "1" ||  name == "6" )
  	//var map	= window.open('/map2.asp?id='+name+'&type=c', 'map'+name, 'width=686,height=598,scrollbars=yes');
	//else if( name == "2" )
  	//var map	= window.open('/map2.asp?id='+name+'&type=c', 'map'+name, 'width=686,height=598,scrollbars=yes');
	//else
		//var map	= window.open('/map2.asp?id='+name+'&type=c', 'map'+name, 'width=686,height=598,scrollbars=yes');

    var map	= window.open('/' + name + '_map', 'map'+name, 'width=686,height=598,scrollbars=yes');
	map.focus();
}

function open_submap( name, region )
{
//	if( name == "5" ||  name == "1" ||  name == "6" )
//  	var map	= window.open('/map2.asp?id='+name+'&subid='+ region+'&type=r', 'map'+name, 'width=686,height=598,scrollbars=yes');
//	else if( name == "2" )
//  	var map	= window.open('/map2.asp?id='+name+'&subid='+ region+'&type=r', 'map'+name, 'width=686,height=598,scrollbars=yes');
//	else
//		var map	= window.open('/map2.asp?id='+name+'&subid='+ region+'&type=r', 'map'+name, 'width=686,height=598,scrollbars=yes');

	var map	= window.open('/' + region + '_map', 'map'+name, 'width=686,height=598,scrollbars=yes');

	map.focus();
}

function open_hotel( id )
{
	var hotel	= window.open('/hotel.asp?id='+id, 'hotel', 'width=500,height=500,scrollbars=yes');

	hotel.focus();
}

function open_journey( id )
{
	var journey = window.open('/journey.asp?id='+id, 'journey', 'width=520,height=600,scrollbars=yes');

	journey.focus();
}

function open_tour()
{
	var tour = window.open('/vtours/tours.htm', 'vtour', 'width=650,height=550,scrollbars=yes');

	tour.focus();
}

function send_email( type, id )
{
	var email = window.open('/email.asp?type='+type+'&id='+id, 'email', 'width=520,height=420,scrollbars=yes');

	email.focus();
}

function user_login( type, id )
{
	var turquoise_window = window.turquoise;

	var url = "/holiday.asp?system=saved&action=login_page&"

	/*if( type )
		url += "type=hotel&"
	else
		url += "type=journey&"

	url += "id=" + id;*/

	turquoise_window.location.href = url;
	turquoise_window.focus();
}

function map_zoom( id )
{
	var mapzoom = window.open('/zoom.asp?id='+id, 'zoom', 'width=364,height=372,scrollbars=yes');

	mapzoom.focus();
}

function image_on( name, image )
{

}

function image_off( name, image )
{

}

function map_on( name )
{
	var map_div = document.getElementById( name );
	var using_div = document.getElementById("using");

  if( map_div )
  {
  	map_div.style.visibility = 'visible';
    map_div.style.display = 'inline';

    using_div.style.visibility = 'hidden';
    using_div.style.display = 'none';
 	}
}

function map_off( name )
{
	var map_div = document.getElementById( name );
	var using_div = document.getElementById("using");

  if( map_div )
  {
  	map_div.style.visibility = 'hidden';
    map_div.style.display = 'none';

    using_div.style.visibility = 'visible';
    using_div.style.display = 'inline';
  }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}



function change_image( name, id, save, type )
{
	var image = document.getElementById( name );
	var field = document.getElementById( save );
	var on = document.getElementById( 'image_' + id );
	var off = document.getElementById( 'image_' + field.value );

	image.src ='/images/preview/' + id + "/" + type + ".jpg";
	field.value = id;	
	
	on.className	= 'image_selected'
	off.className	= 'image_number';
	
	return( false );
}

function zoom_image( type, name, id, save )
{
	var field = document.getElementById( save );
	
	window.open('/images.asp?type=' + escape( type ) + '&name=' + escape( name ) + '&id='+id+'&image='+field.value, 'image_zoom','width=640, height=484, scrollbar=no');
	
	return( false );
}

function previous_image( name, save, type )
{
	var saved = document.getElementById( save ).value;
	var found = false;
	var finished = false;
	var counter = 0;
	var previous;
	
	var list = window.images;
	
	while( ! finished )
	{
		if( list[ counter ] == saved )
		{
			finished = true;
			found = true;
		}
		
		if( ! finished )
		{
			counter ++;
		}
		
		if( counter > list.length )
		{
			finished = true;
		}
	}

	if( found )
	{
		if( counter > 0 )
		{
			counter --;
		}
		else
		{
			counter = list.length - 1;	
		}
		
		previous = list[ counter ];

		change_image( name, previous, save, type );
	}
		
	return( false );
}

function next_image( name, save, type )
{
	var saved = document.getElementById( save ).value;
	var found = false;
	var finished = false;
	var counter = 0;
	var next;
	
	var list = window.images;
	
	while( ! finished )
	{
		if( list[ counter ] == saved )
		{
			finished = true;
			found = true;
		}
		
		if( ! finished )
		{
			counter ++;
		}
		
		if( counter > list.length )
		{
			finished = true;
		}
	}

	if( found )
	{
		counter++;
		
		if( counter >= list.length )
		{
			counter = 0;
		}
		
		next = list[ counter ];

		change_image( name, next, save, type );
	}
		
	return( false );
}

function MM_effectAppearFade(targetElement, duration, from, to, toggle)
{
	
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
	//var flash = document.getElementById('flash');
	//flash.style.display = 'block';
	
	window.setTimeout('hide();', 1000);
}
function hide() {
	var flash = document.getElementById('flash');
	flash.style.display = 'block';

	var fadey = document.getElementById('Fadey');
	fadey.style.display = 'none';
	fadey.style.visibility = 'hidden';
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openWin(url,name,width,height) {

	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	var features = "width=" + width + ", height=" + height + ", top=" + top + ", left=" + left + ", toolbars=no, location=no, status=no, scrollbars=no, titlebar=no, resizable=no, directories=no, menubar=no";
	var myWindow = window.open(url, name, features);
		myWindow.focus();	
}