/*----------------------------------------------*/
/*			   Ghrs All Destinations  			*/
/*----------------------------------------------*/

/* Next piece of code has the behavior to manage the "view all destinations	*/ 
/* locality" and its div or iframe that focus the user on itself. 		*/

/* Global variables */
var ghrs_view_dest_src = ''; 
var ghrs_view_locs_src = '';

/* This function has the behavior to set correctly the dimensions of the iframe */
/* of "view all destinations list".						*/
function ghrs_setPositionAndDimensionLocalityView(random){
	var destinations = String('destination_list_'+random);
	var ifrdest = document.getElementById(destinations);
	var dest = self.frames[destinations];
	if(ifrdest){
		if(navigator.appName.indexOf("Netscape")>-1) {
			ifrdest.marginWidth = 1;
			ifrdest.marginHeight = 1;
			ifrdest.style.padding = "0.2em";
			ifrdest.style.border = "0";
			ifrdest.style.overflowX = "hidden";
		}
		ifrdest.style.fontSize = "12px";
		if(window.getHeight) var positionY = Math.floor((parseInt(window.getHeight(),10) - 500)/2);
		else positionY = 500;
		if(window.getWidth) var positionX = Math.floor((parseInt(window.getWidth(),10) - 500)/2);
		else positionX = 500;
		ifrdest.style.left = positionX + 'px';
		ifrdest.style.top = positionY + 'px';
		var index = navigator.appVersion.indexOf("MSIE");
		if(!((index > -1) && (parseInt(navigator.appVersion.substr(index+5),10) == 6))){
			ifrdest.style.position = "fixed";
		}
	}
}

/* This is the function that will show and hide the iframe and that will show or */
/* hide the div or the iframe that focus the user on the list. 			 */
function ghrs_showAllDestinations(random,event){
	if(ghrs_loaded){
		ghrs_list_random = random;
		if(ghrs_fixAllDestsElements(random)){
			ghrs_addAllDestsElements(random);
			// Uploading view all destination iframe source
			if(document.getElementById('destination_list_' + random)!=null){
				document.getElementById('destination_list_' + random).src = ghrs_view_dest_src;
				document.getElementById("span_destination_list_"+random+"_status").innerHTML = 0;
			}
		}
		var ifrdest = document.getElementById('destination_list_' + random);
		ghrs_setPositionAndDimensionLocalityView(random);
		if(parseInt(document.getElementById("span_destination_list_"+random+"_status").innerHTML,10) == 0){
			if(document.getElementById("external_calendar_div")) ghrs_closeCalendarDiv();
			document.getElementById("span_destination_list_"+random+"_status").innerHTML = 1;
			ifrdest.style.display = 'block';
			ghrs_disableMainPageScroll();
			ghrs_showLightBox();
			var elem_iframe = window.frames['destination_list_' + ghrs_list_random];
			elem_iframe.scrollTo(0,0);
			if(elem_iframe.document.getElementById("selected_country")) elem_iframe.document.getElementById("selected_country").selectedIndex = 0;		
		}
		else{
			if(document.getElementById("external_calendar_div")) ghrs_closeCalendarDiv();
			document.getElementById("span_destination_list_"+random+"_status").innerHTML = 0;
			ifrdest.style.display = 'none';
			ghrs_hideLightBox();
			ghrs_enableMainPageScroll();
		}
	}
}

/* This function allow the addition of All Destinations uninitialized elements */
function ghrs_addAllDestsElements(random){
	// Setting  calendar code and inseting calendar into page
	var attributes = new Array();
	if(!document.getElementById("destination_list_" + random)){
		attributes = { 'name':('destination_list_'+random), 'id':('destination_list_'+random), 'class':'destination_list', 'src': ghrs_view_dest_src, 'scrolling':'yes', 'frameborder':'0', 'marginheight':'0', 'marginwidth':'0' };
		var dest_iframe = ghrs_createElementWithAttribute('iframe',attributes,null);
		document.getElementsByTagName("body")[0].appendChild(dest_iframe);
	}
	if(!document.getElementById("span_destination_list_"+random+"_status")){
		attributes = { 'id':('span_destination_list_'+random+'_status'), 'style':'display : none;' };
		var span = ghrs_createElementWithAttribute('span',attributes,0);
		document.getElementsByTagName("body")[0].appendChild(span);
	}
	if(!document.getElementById("hide_main_window_list")){
		attributes = { 'id':'hide_main_window_list', 'class':'hide_main_window_list', 'onclick':'ghrs_showAllDestinations(\'' + random + '\');' };
		var div = ghrs_createElementWithAttribute('div',attributes,null);
		//* Internet Explorer
		if(window.attachEvent) div.onclick = function() { ghrs_showAllDestinations(random); };
		document.getElementsByTagName("body")[0].appendChild(div);
	}
	if(!document.getElementById("iframe_hide_main_window_list") && ghrs_isExplorer6()){
		attributes = { 'id':'iframe_hide_main_window_list', 'name':'iframe_hide_main_window_list', 'class':'hide_main_window_list', 'onfocus':'ghrs_showAllDestinations(\'' + random + '\');',  'src':'.', 'frameborder':'0', 'marginheight':'0', 'marginwidth':'0' };
		var iframe = ghrs_createElementWithAttribute('iframe',attributes,null);
		// Internet Explorer
		iframe.onfocus = function() { ghrs_showAllDestinations(random); };
		document.getElementsByTagName("body")[0].appendChild(iframe);
		self.frames['iframe_hide_main_window_list'].document.write(""); 
		self.frames['iframe_hide_main_window_list'].document.close();
	}
}

/* This function allow to test if an All Destinations's elements still uninitialized */
function ghrs_fixAllDestsElements(random){
	var dests_ifr = (!document.getElementById("destination_list_" + random));
	var dests_span = (!document.getElementById("span_destination_list_"+random+"_status"));
	var dests_hide_div = (!document.getElementById("hide_main_window_list"));
	var dests_hide_ifr = (!document.getElementById("iframe_hide_main_window_list") && ghrs_isExplorer6());
	return dests_ifr || dests_span || dests_hide_div || dests_hide_ifr;
}

/* This function is called when the user choose a localiy from the list. 	*/
function ghrs_loc_select(loc,code,country) {
	var params_loc = document.getElementsByName("param[loc_search]");
	for(var i = 0; i < params_loc.length; i++){
		params_loc[i].value = loc;
	}
	var dest_name = String('destination_list_'+ghrs_list_random);
	var dest = document.getElementById(dest_name);
	dest.style.display = 'none';
	document.getElementById("span_destination_list_"+ghrs_list_random+"_status").innerHTML = 0;
	document.getElementById("all_dest_loc_reg_code").value = code;
	document.getElementById("all_dest_loc_reg_code").name = 'param[loc]';
	document.getElementById("all_dest_loc_reg_code").disabled = false;
	document.getElementById("loc_country").value = country;
	document.getElementById("loc_country").disabled = false;
	ghrs_clearRadios(ghrs_list_random);
	ghrs_removeAllDestinationsAlert(null);
	ghrs_hideLightBox();
	ghrs_enableMainPageScroll();
}

/* This function is called when the user choose a country from the list. 	*/
function ghrs_country_select(country, payment){
	var iframe= document.getElementById('destination_list_' + ghrs_list_random);
	var elem_iframe = window.frames['destination_list_' + ghrs_list_random];
	elem_iframe.document.getElementById("iframe_content").innerHTML="";
	var loading_div = elem_iframe.document.getElementById("loading_locs");
	var loading_div_elem = elem_iframe.document.getElementById("loading_locs_elem");
	loading_div.style.display="";
	loading_div.style.width="100%";
	loading_div.style.height="100%";
	var now_loading = setInterval('ghrs_setColor()',250);
	var new_src = ghrs_view_locs_src + '&param[goto][country]=' + country;
	if(payment=='pre'){
		if(new_src.search('payment]=post') > -1) new_src = new_src.replace('payment]=post','payment]=pre');
		else if(new_src.search('payment]=pre') < 0) new_src += '&param[payment]=pre';
	}
	else{
		if(new_src.search('payment]=pre') > -1) new_src = new_src.replace('payment]=pre','payment]=post');
		else if(new_src.search('payment]=post') < 0) new_src += '&param[payment]=post';
	}
	iframe.src = new_src;
}

/* This function has the behaviour of clear the input text when a radio is selected. */
function ghrs_clearInputText(random,code){
	var loc_searc_name = "loc_search_" + random;
	document.getElementById(loc_searc_name).value = '';
	var elem = document.getElementById(code);
	elem.checked = true;
	ghrs_radio_selected = true;
	document.getElementById("all_dest_loc_reg_code").value = '';
	document.getElementById("all_dest_loc_reg_code").name = '';
	document.getElementById("all_dest_loc_reg_code").disabled = true;
	ghrs_setAttribute(document.getElementById('check_'+random),'action','?');
}

/* This functiont is used to switch between radios and input text. */
function ghrs_switchRadiosWithInputText(value,random){
	if(value!=''){
		if(ghrs_radio_selected){
			ghrs_clearRadios(random)
			ghrs_radio_selected = false;
		}
	}
	else{
		ghrs_radio_selected = true;
		ghrs_clearRadios(random)
		var form_name = "check_" + random;
		var input_array = document.getElementById(form_name).getElementsByTagName("input");
		var i = 0;
		while(input_array[i].getAttribute("type")!= "radio") i++;
		if(input_array[i].getAttribute("type") == "radio") input_array[i].checked = true;
		document.getElementById("all_dest_loc_reg_code").value = '';
		document.getElementById("all_dest_loc_reg_code").name = '';
		document.getElementById("all_dest_loc_reg_code").disabled = true;
	}
}

/* This function has the behaviour of clear radios when a text is inserted */
/* in the input text. */
function ghrs_clearRadios(random){
	if(document.getElementById("check_" + random)){
		var input_array = document.getElementById("check_" + random).getElementsByTagName("input");
		for(var i=0; input_array[i]; i++){
			if(input_array[i].getAttribute("type") == "radio"){
				input_array[i].checked = false;
			}
		}
	}
}

/* This function has the behaviour to reload the type of peyment for the localities. */
function ghrs_reloadViewAllDestinations(payment, random){
	ghrs_list_random = random;
	if(ghrs_fixAllDestsElements(ghrs_list_random)) ghrs_addAllDestsElements(ghrs_list_random);
	var new_src = String(ghrs_view_dest_src);
	if(payment=='pre'){
		if(new_src.search('payment]=post') > -1) new_src = new_src.replace('payment]=post','payment]=pre');
		else if(new_src.search('payment]=pre') < 0) new_src += '&param[payment]=pre';
		window.frames['destination_list_' + ghrs_list_random].location.replace(new_src);
		document.getElementById("span_destination_list_"+ghrs_list_random+"_status").innerHTML = 0;
	}
	else{
		if(new_src.search('payment]=pre') > -1) new_src = new_src.replace('payment]=pre','payment]=post');
		else if(new_src.search('payment]=post') < 0) new_src += '&param[payment]=post';
		window.frames['destination_list_' + ghrs_list_random].location.replace(new_src);
		document.getElementById("span_destination_list_"+ghrs_list_random+"_status").innerHTML = 0;
	}
	default_payment = payment;
	document.getElementById("loc_search_" + ghrs_list_random).value = '';
	ghrs_switchRadiosWithInputText('', ghrs_list_random);
}

/*----------------------------------------------*/
/*		Wiev all destinations without frame		*/
/*----------------------------------------------*/

function ghrs_showAllDestinatiosHTML(http_request){
	if(http_request.readyState == 4){
		/* If the state is ready */
		if(http_request.status == 200){
			/* If the request has been executed correctly */     
			var substring_after = http_request.responseText.indexOf("<result>");
			var substring_before = http_request.responseText.lastIndexOf("</result>");
			if(substring_after>0 && substring_before>0){
				document.getElementsByTagName('body')[0].style.cursor = 'default';
				var result = http_request.responseText.substring(substring_after+8,substring_before);
				var div = ghrs_createElementWithAttribute('div',{'id':'all_destination_container_div'});
				document.getElementsByTagName("body")[0].appendChild(div);
				document.getElementById('all_destination_container_div').innerHTML = result;
				ghrs_setPositionAndDimensionAllDestDiv();
				ghrs_initScrollerDiv('all_destination_content_div');
				ghrs_showHideElements();
				document.getElementById('all_destination_container_div').style.display = '';
				document.getElementById('span_destination_list_div_status').innerHTML = 1;
			}
			else{
				document.getElementsByTagName('body')[0].style.cursor = 'default';
				alert("Result element not found!!!")
			}
		}
	}
}

/* Function called at each state change */
function ghrs_showAllDestinationsDiv(random) {
	if(ghrs_loaded){
		ghrs_list_random = random;
		if(ghrs_fixAllDestsElementsDiv()){
			ghrs_addAllDestsElementsDiv(random);
		}
		if(document.getElementById('all_destination_container_div')){
			if(document.getElementById('span_destination_list_div_status').innerHTML==0){
				ghrs_showHideElements();
				ghrs_resetScroll();
				document.getElementById('all_destination_container_div').style.display = '';
				document.getElementById('span_destination_list_div_status').innerHTML = 1;
			}
			else{
				document.getElementById('all_destination_container_div').style.display = 'none';
				document.getElementById('span_destination_list_div_status').innerHTML = 0;
				ghrs_hideHiddenElements();
			}
		}
		else{
			document.getElementsByTagName('body')[0].style.cursor = 'wait';
			var url = "?bodyonly=1&action=form_locality_list&target=ajax&format=xml-ext&param[layout][columns]=4&param[layout][order]=country&param[ajax_all]=1&param[lang]=" + lang + "&param[internal]=" + default_internal + "&param[payment]=" + default_payment;
			ghrs_makeRequest(url,'ghrs_showAllDestinatiosHTML');
		}
	}		
}

var back_wheel_func;

function ghrs_showHideElements(){
	window.scrollTo(0,0);
	if(ghrs_isExplorer()) document.body.scroll = "no"; //Internet Explorer
	document.documentElement.style.overflow = 'hidden'; //Common browsers
	if(ghrs_isExplorer6()){
		var lightbox = document.getElementById("iframe_hide_main_window_list");
		lightbox.style.height = window.document.body.scrollHeight + "px";
		lightbox.style.width = getWidth() + "px";
	}
	else{
		var lightbox = document.getElementById("hide_main_window_list");
		lightbox.style.height = "100%";
		lightbox.style.width = "100%";
	}
	if(window.addEventListener && ghrs_isFirefox())	window.addEventListener('DOMMouseScroll', ghrs_wheelMoveAllDestinations, false);
	else{ 
		back_wheel_func = (window.onmousewheel) ? window.onmousewheel : document.onmousewheel;
		window.onmousewheel = document.onmousewheel = function(){ghrs_wheelMoveAllDestinations(event); return false;};
	}
}

var scrolling = false;

function ghrs_wheelMoveAllDestinations(event){
	if(!scrolling){
		scrolling = true;
		ver = (event.wheelDelta)?event.wheelDelta:(-event.detail);
		if(ver){
			if(ver>0){
				ghrs_scrollDiv(200, 200);
				ghrs_stopScrollDiv();
			}
			else{
				ghrs_scrollDiv(-200, 200);
				ghrs_stopScrollDiv();
			}
		}
		setTimeout(function(){scrolling = false;}, 10);
	}
	return false;
}

function ghrs_hideHiddenElements(){
	if(ghrs_isExplorer6()) var lightbox = document.getElementById("iframe_hide_main_window_list");
	else var lightbox = document.getElementById("hide_main_window_list");
	lightbox.style.height = 0;
	lightbox.style.width = 0;
	if(ghrs_isExplorer()) document.body.scroll = "yes"; //Internet Explorer
	document.documentElement.style.overflow = 'auto'; //Common browsers
	window.scrollTo(0,1);
	window.scrollTo(0,0);
	window.onmousewheel = document.onmousewheel = back_wheel_func;
	if(window.addEventListener && ghrs_isFirefox())	window.removeEventListener('DOMMouseScroll', ghrs_wheelMoveAllDestinations, false);
}

/* All destinations scroll managing */
var all_dest_scroll, title_off_height, clip_height, clip_top;
var clip_off_height, table_off_height, clip_interval, neg_scroll;
var clip_top = 0;

function ghrs_initScrollerDiv(id) {
    all_dest_scroll = document.getElementById(id);
    
    var scroll_height_controls = document.getElementById(id + '_controls');

    // Style per il div interno (testo)
    all_dest_scroll.style.width = document.getElementById("all_destination_container_div").offsetWidth - 24 + 'px';
    all_dest_scroll.style.height = 'auto';
    all_dest_scroll.style.overflow = 'hidden';
    
    // Style per il div esterno (contenitore)
    document.getElementById("all_destination_container_div").style.overflow = 'hidden';
    
    // Style per il div con i controlli (testo)
    scroll_height_controls.style.display = 'block';  

    // Impostazioni per visualizzare la parte di testo superiore
    clip_height  = all_dest_scroll.offsetHeight;
    clip_top = 0;
    clip_off_height = document.getElementById("all_destination_container_div").offsetHeight;
	table_off_height = all_dest_scroll.getElementsByTagName('table')[0].offsetHeight;
	title_off_height = document.getElementById('all_dest_top_title').offsetHeight;
	var scroll_elem = document.getElementById('all_dest_scrolling_element');
	scroll_elem.style.top = '50px';
	scroll_elem.style.zIndex = parseInt(document.getElementById('all_dest_scrolling_container').style.zIndex,10) + 1;
	ghrs_setAttribute(scroll_elem, "onmousedown", "ghrs_mouseDragScrollElement(event);");
}

function ghrs_scrollDiv(scrollto, time) {
	ghrs_refreshNegScroll();
	if((clip_top!=0 && scrollto > 0) || (clip_top!=neg_scroll && scrollto < 0)){
		clip_top += scrollto;
		if(clip_top > 0 && scrollto > 0) clip_top = 0;
		if(clip_top < neg_scroll && scrollto < 0){
			clip_top = neg_scroll;
		}
		all_dest_scroll.style.top = clip_top + 'px';
		document.getElementById('all_dest_scrolling_element').style.top = Math.round((clip_top * 300)/neg_scroll) + 50 + 'px';
		clip_interval = setTimeout('ghrs_scrollDiv('+ scrollto +', '+ time +')', time);
	}
}

function ghrs_stopScrollDiv() {
    if(clip_interval) clearTimeout(clip_interval);
}

function ghrs_resetScroll(){
	clip_top = 0;
	ghrs_refreshNegScroll();
	document.getElementById('all_dest_scrolling_element').style.top = Math.round((clip_top * 300)/neg_scroll) + 50 + 'px';
	all_dest_scroll.style.top = clip_top + 'px';
	document.getElementById('selected_country').selectedIndex = 0;
}

function ghrs_goToCountry(elem_top){
	clip_top = -(elem_top + 10);
	ghrs_refreshNegScroll();
	document.getElementById('all_dest_scrolling_element').style.top = Math.round((clip_top * 300)/neg_scroll) + 50 + 'px';
	all_dest_scroll.style.top = clip_top + 'px';
}

function ghrs_refreshNegScroll(){
	neg_scroll = clip_off_height - title_off_height - table_off_height;
}

function ghrs_setPositionAndDimensionAllDestDiv(){
	var div = document.getElementById('all_destination_container_div');
	if(div){
		if(window.getHeight) var positionY = Math.floor((parseInt(window.getHeight(),10) - 500)/2);
		else positionY = 500;
		if(window.getWidth) var positionX = Math.floor((parseInt(window.getWidth(),10) - 500)/2);
		else positionX = 500;
		div.style.left = positionX + 'px';
		div.style.top = positionY + 'px';
		var index = navigator.appVersion.indexOf("MSIE");
		if(ghrs_isExplorer6()){
			ifrdest.style.position = "fixed";
		}
		if(ghrs_isExplorer6()) var lightbox = document.getElementById("iframe_hide_main_window_list");
		else var lightbox = document.getElementById("hide_main_window_list");
		div.style.zIndex = parseInt(lightbox.style.zIndex,10) + 1;
	}
}

function ghrs_fixAllDestsElementsDiv(){
	var dests_hide_div = (!document.getElementById("hide_main_window_list"));
	var dests_hide_ifr = (!document.getElementById("iframe_hide_main_window_list") && ghrs_isExplorer6());
	return dests_hide_div || dests_hide_ifr;
}

function ghrs_addAllDestsElementsDiv(random){
	
	// Setting  calendar code and inseting calendar into page
	var attributes = new Array();
	if(!document.getElementById("hide_main_window_list")){
		attributes = { 'id':'hide_main_window_list', 'class':'hide_main_window_list', 'onclick':'ghrs_showAllDestinationsDiv("'+ random +'");' };
		var div = ghrs_createElementWithAttribute('div',attributes,null);
		// Internet Explorer
		if(window.attachEvent) div.onclick = function() { ghrs_showAllDestinationsDiv(random); };
		document.getElementsByTagName("body")[0].appendChild(div);
		document.getElementById('hide_main_window_list').style.zIndex = 100;
	}
	if(!document.getElementById("iframe_hide_main_window_list") && ghrs_isExplorer6()){
		attributes = { 'id':'iframe_hide_main_window_list', 'name':'iframe_hide_main_window_list', 'class':'hide_main_window_list', 'onfocus':'ghrs_showAllDestinationsDiv("'+ random +'");',  'src':'.', 'frameborder':'0', 'marginheight':'0', 'marginwidth':'0' };
		var iframe = ghrs_createElementWithAttribute('iframe',attributes,null);
		// Internet Explorer
		iframe.onfocus = function() { ghrs_showAllDestinations(random); };
		document.getElementsByTagName("body")[0].appendChild(iframe);
		self.frames['iframe_hide_main_window_list'].document.write(""); 
		self.frames['iframe_hide_main_window_list'].document.close();
		document.getElementById('iframe_hide_main_window_list').style.zIndex = 100;
	}
}

function ghrs_div_loc_select(loc,code,country) {
	var params_loc = document.getElementsByName("param[loc_search]");
	for(var i = 0; i < params_loc.length; i++){
		params_loc[i].value = loc;
	}
	document.getElementById('all_destination_container_div').style.display = 'none';
	document.getElementById("span_destination_list_div_status").innerHTML = 0;
	document.getElementById("all_dest_loc_reg_code").value = code;
	document.getElementById("all_dest_loc_reg_code").name = 'param[loc]';
	document.getElementById("all_dest_loc_reg_code").disabled = false;
	document.getElementById("loc_country").value = country;
	document.getElementById("loc_country").disabled = false;
	ghrs_clearRadios(ghrs_list_random);
	ghrs_removeAllDestinationsAlert(null);
	ghrs_hideHiddenElements();
}

var back_onmousemove, back_onmouseup, calling_y;
var exit_drag = false;

function ghrs_mouseDragScrollElement(event){
	//document.getElementById(this.int_id + '_top_bar').style.cursor = 'move';
	var coords = ghrs_mouseMovement(event);
	calling_y = coords[1];
	back_onmousemove = document.getElementsByTagName("body")[0].onmousemove;     
	back_onmouseup = document.getElementsByTagName("body")[0].onmouseup;
	exit_drag = true;
	ghrs_setAttribute(document.getElementsByTagName("body")[0], 'onmousemove', 'ghrs_dragScrollElement(event)');
	ghrs_setAttribute(document.getElementsByTagName("body")[0], 'onmouseup', 'ghrs_mouseStopDragScrollElement()');
}

function ghrs_mouseStopDragScrollElement(){
	exit_drag = false;
	ghrs_setAttribute(document.getElementsByTagName("body")[0], 'onmousemove', back_onmousemove);
	ghrs_setAttribute(document.getElementsByTagName("body")[0], 'onmouseup', back_onmouseup);
}

function ghrs_dragScrollElement(event){
	if(exit_drag){
		var coords = ghrs_mouseMovement(event);
		var current_y = coords[1];
		ghrs_mouseScrollDiv(current_y,calling_y);
		calling_y = current_y;
	}
}

function ghrs_mouseScrollDiv(current_y,calling_y) {
	ghrs_refreshNegScroll();
	var scroll_mov = current_y - calling_y; 
	var scrollto = Math.round((scroll_mov * neg_scroll)/300);
	if((clip_top!=0 && scrollto > 0) || (clip_top!=neg_scroll && scrollto < 0)){
		clip_top += scrollto;
		if(clip_top > 0 && scrollto > 0) clip_top = 0;
		if(clip_top < neg_scroll && scrollto < 0){
			clip_top = neg_scroll;
		}
		all_dest_scroll.style.top = clip_top + 'px';
		document.getElementById('all_dest_scrolling_element').style.width = '16px';
		document.getElementById('all_dest_scrolling_element').style.top = Math.round((clip_top * 300)/neg_scroll) + 50 + 'px';
		document.getElementById('all_dest_scrolling_element').style.width = '16px';
		//clip_interval = setTimeout('ghrs_scrollDiv('+ scrollto +', '+ time +')', time);
	}
}

function ghrs_changeAllDestinationsHREF(link,random){
	ghrs_setAttribute(link,'href','javascript:ghrs_showAllDestinations("'+random+'")');
}
