// Temporary variables to hold mouse x-y pos.s
var tempX = 0 ;
var tempY = 0 ;
	
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all ? true : false ;

window.onscroll = positioning_elements ;
document.onmousemove = getMouseXY ;

function getMouseXY(e) {
	////////////////////////////////////////////
	// Aflam  pozitia mouseului
	
	
	if (IE) { // grab the x-y pos.s if browser is IE
   		tempX = event.clientX + document.body.scrollLeft ;
   		tempY = event.clientY + document.body.scrollTop ;
	} else {  // grab the x-y pos.s if browser is NS
   		tempX = e.pageX ;
   		tempY = e.pageY ;
	} 
	// catch possible negative values in NS4
	if (tempX < 0) {
		tempX = 0 ;
	}
	if (tempY < 0) {
		tempY = 0 ;
	}
	
	//$('input_tempX').value = tempX ;
	//$('input_tempY').value = tempY ;
}

function positioning_elements() {
	//	marimea coverului
	var WindowInnerWidth = getWindowInnerWidth() ;
	var WindowInnerHeight = getWindowInnerHeight() ;
	
	var ScrollX = getScrollX() ;
	var ScrollY = getScrollY() ;	
	
	var PosY = findPosY($('img_pos_rel_cover')) ;
	
	if (WindowInnerHeight + ScrollY > PosY) 
		$('div_cover').style.height = WindowInnerHeight + ScrollY + "px" ;
	else
		$('div_cover').style.height = PosY + "px" ;
	
	$('div_cover').style.width = WindowInnerWidth + ScrollX + "px" ;
	
	for (var i = 1; i <= totals_submenus; i++) {
		
		var X_td = parseInt(findPosX($('td_' + i))) ;
		var Y_a = parseInt(findPosY($('td_' + i))) ;
		
		var X_img_right_finished_window = parseInt(findPosX($('img_right_finished_window'))) ;
		
		//alert (X_img_right_finished_window) ;
		
		var curr_div_submenu_Width = div_submenus_widths['div_submenu_' + i] ;
		if (X_img_right_finished_window < X_td + curr_div_submenu_Width) {
			X_td = X_td - ( curr_div_submenu_Width - (X_img_right_finished_window - X_td) ) ;
		}
		
		$('div_submenu_' + i).style.left = X_td + "px" ;
		$('div_submenu_' + i).style.top = Y_a + 30 + "px" ;		
	}	

	var divs_container = document.getElementsByTagName('div') ;
	
	for (var no = 0; no < divs_container.length; no++) {
		if (divs_container[no].className == "div_container" || divs_container[no].className == "div_container_review" ) {
			var current_id = divs_container[no].id ;
			
			var curr_div_container_window_width = divs_containers_widths[current_id] ;
			var curr_div_container_window_height = divs_containers_heights[current_id] ;
		
			$(current_id).style.top = (WindowInnerHeight - curr_div_container_window_height) / 2 + ScrollY + "px" ;
			$(current_id).style.left = (WindowInnerWidth - curr_div_container_window_width) / 2 + ScrollX + "px" ;
		} else if (divs_container[no].className == "div_container_module" ) {
			var current_id = divs_container[no].id ;
			
			if (divs_containers_widths[current_id] == 0)
				divs_containers_widths[current_id] = getWidth(current_id, true, true) ;
			if (divs_containers_heights[current_id] == 0)
				divs_containers_heights[current_id] = getHeight(current_id, true, true) ;			
		}
	}	
}

var position_modules = false ;
var position_modules_counter = 0 ;

function positioning_modules() {
	if (with_country) {
		if (ind_country != "no") {
			var curr_location = ind_country ;
		} else {
			var curr_location = country_name ;	
		}		
		
		if (with_state)
			curr_location += ' / ' + state_name ;
		if (with_city) {
			if (ind_city != "no") {
				curr_location += ' / ' + ind_city ;
			} else {
				curr_location += ' / ' + city_name ;
			}
		}			
	} else {
		$('td_current_location').hide() ;
	}
	
	var str = "" ;
	str += '<table border="0" cellspacing="0" cellpadding="0" align="right">' ;
	str += '<tr>' ;
	str += '<td style="width:9px;"><img src="' + abs_url_site + '_images/arro-change-location_left.png" alt="left" width="9" height="28" class="fix"/></td>' ;
	str += '<td style="height:28px; background-image:url(' + abs_url_site + '_images/arro-change-location_m.png); background-repeat:repeat-x; font-size:11px;" align="center">' + curr_location + '</td>' ;
	str += '<td style="width:9px;"><img src="' + abs_url_site + '_images/arro-change-location_right_.png" alt="left" width="9" height="28" class="fix"/></td>' ;
	str += '</tr>' ;
	str += '</table>' ;
	$('td_current_location').update(str) ;
	
						
	var Y_td_main_content_container = parseInt(findPosY($('img_pos_rel_modules'))) ;
	var X_td_main_content_container = parseInt(findPosX($('td_main_content_container'))) ;
	
	//alert (Y_td_main_content_container) ;
	
	td_main_content_container_height = 0 ;
	
	var height_small_column_left = 0 ;
	var height_small_column_center_left = 0 ;
	var height_small_column_center_right = 0 ;
	var height_small_column_right = 0 ;
	var height_big_column_left = 0 ;
	var height_big_column_right = 0 ;
	
	var height_1_big_left = 0 ;
	var height_1_big_right = 0 ;
	var height_1_small_left = 0 ;	
	var height_1_small_center_left = 0 ;
	var height_1_small_center_right = 0 ;
	var height_1_small_right = 0 ;	
	
	var height_2_big_left = 0 ;
	var height_2_big_right = 0 ;
	var height_2_small_left = 0 ;	
	var height_2_small_center_left = 0 ;
	var height_2_small_center_right = 0 ;
	var height_2_small_right = 0 ;	
	
	var height_horiz_center_1 = 0 ;
	var height_horiz_center_2 = 0 ;
	
	var is_module_platinium = false ;
	var is_module_copyright = false ;
	
	var platinium_key = "" ;
	var footer_copyright_key = "" ;	
	
	for (key in modules_arangement) {
		
		switch(modules_arangement[key]) {
			case "1_big_left":
  				
				height_big_column_left += divs_containers_heights["div_module_" + key] ;
				
				height_1_big_left = divs_containers_heights["div_module_" + key] ;				
				
				break;
			case "1_small_left":
  				
				height_small_column_left += divs_containers_heights["div_module_" + key] ;
				
				height_1_small_left = divs_containers_heights["div_module_" + key] ;				
				
 	 			break;
			case "1_big_right":
  				
				height_big_column_right += divs_containers_heights["div_module_" + key] ;
				
				height_1_big_right = divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "1_small_center_left":
  				
				height_small_column_center_left += divs_containers_heights["div_module_" + key] ;
				
				height_1_small_center_left = divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "1_small_center_right":
  				
				height_small_column_center_right += divs_containers_heights["div_module_" + key] ;
				
				height_1_small_center_right = divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "1_small_right":
  				
				height_small_column_right += divs_containers_heights["div_module_" + key] ;
				
				height_1_small_right = divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "2_big_left":
  				
				height_big_column_left += divs_containers_heights["div_module_" + key] ;			
				
				height_2_big_left = divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "2_small_left":
  				
				height_small_column_left += divs_containers_heights["div_module_" + key] ;			
				
				height_2_small_left = divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "2_big_right":
  				
				height_big_column_right += divs_containers_heights["div_module_" + key] ;
				
				height_2_big_right = divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "2_small_center_left":
  				
				height_small_column_center_left += divs_containers_heights["div_module_" + key] ;
				
				height_2_small_center_left = divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "2_small_center_right":
  				
				height_small_column_center_right += divs_containers_heights["div_module_" + key] ;
				
				height_2_small_center_right = divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "2_small_right":
			
  				height_small_column_right += divs_containers_heights["div_module_" + key] ;
				
				height_2_small_right = divs_containers_heights["div_module_" + key] ;
				
 	 			break;	
			case "horiz_center_1":
				
				var is_module_platinium = true ;
				td_main_content_container_height += divs_containers_heights["div_module_" + key] ;
				
				height_horiz_center_1 += divs_containers_heights["div_module_" + key] ;
				
 	 			break;
			case "horiz_center_2":				
				
				var is_module_copyright = true ;
				td_main_content_container_height += divs_containers_heights["div_module_" + key] ;
				
				height_horiz_center_2 += divs_containers_heights["div_module_" + key] ;
				
 	 			break;			
		}	
	}
	
	/*alert (height_small_column_left) ;
	alert (height_small_column_right) ;
	alert (height_small_column_center_left) ;
	alert (height_small_column_center_right) ;	
	alert (height_big_column_left) ;
	alert (height_big_column_right) ;*/
	
	var max_height_column = Math.max ( Math.max ( Math.max(height_small_column_left, height_small_column_right), Math.max(height_small_column_center_left, height_small_column_center_right) ), Math.max(height_big_column_left, height_big_column_right) ) ;
	
	//alert (max_height_column) ;
	td_main_content_container_height += max_height_column ;
	
	var nr_bottom_modules = 0 ;
	if (is_module_platinium) {
		nr_bottom_modules++ ;
		
	}
	if (is_module_copyright) {
		nr_bottom_modules++ ;
		
	}
	td_main_content_container_height += (nr_bottom_modules + 2) * modules_vert_dist ;	
	
	//alert (td_main_content_container_height) ;
	
	$('td_main_content_container').style.height = td_main_content_container_height + "px" ;
	
	$('td_main_content_container').style.backgroundImage = "url(" + abs_url_site + "_images/blank.gif)";
	
	var curr_top = Y_td_main_content_container + modules_vert_dist ;
	var curr_left = X_td_main_content_container + modules_hor_dist ;
	
	var curr_left_1 = X_td_main_content_container + modules_hor_dist ;
	var curr_left_2 = X_td_main_content_container + modules_hor_dist ;	
	
	var top = 0 ;
	
	for (key in modules_arangement) {
		switch(modules_arangement[key]) {
			case "1_big_left":
  				
				$('div_module_' + key).style.top = curr_top + "px" ;
				$('div_module_' + key).style.left = curr_left_1 + "px" ;
				
				break;
			case "1_small_left":
  				
				//alert (curr_left_1) ;
				$('div_module_' + key).style.top = curr_top + "px" ;
				$('div_module_' + key).style.left = curr_left_1 + "px" ;
				
 	 			break;
			case "1_big_right":
  				$('div_module_' + key).style.top = curr_top + "px" ;
				$('div_module_' + key).style.left = curr_left_1 + width_modules + modules_hor_dist + "px" ;
				
 	 			break;
			case "1_small_center_left":
  				
				$('div_module_' + key).style.top = curr_top + "px" ;
				$('div_module_' + key).style.left = curr_left_1 + width_modules + modules_hor_dist + "px" ;
				
 	 			break;
			case "1_small_center_right":
  				
				$('div_module_' + key).style.top = curr_top + "px" ;
				$('div_module_' + key).style.left = curr_left_1 + 2 * (width_modules + modules_hor_dist) + "px" ;
				
 	 			break;
			case "1_small_right":
 				
				$('div_module_' + key).style.top = curr_top + "px" ;
				$('div_module_' + key).style.left = curr_left_1 + 3 * (width_modules + modules_hor_dist) + "px" ;
				
 	 			break;
			case "2_big_left":
  				
				max_height_column = Math.max(Math.max(height_1_small_left, height_1_small_center_left), height_1_small_center_right) ;
				top = curr_top + max_height_column + modules_vert_dist ;
				
				$('div_module_' + key).style.top = top + "px" ;
				$('div_module_' + key).style.left = curr_left_2 + "px" ;				
				
 	 			break;
			case "2_small_left":
  				
				if (height_1_small_left > 0)
					top = curr_top + height_1_small_left + modules_vert_dist ;
				else if (height_1_big_left > 0)
					top = curr_top + height_1_big_left + modules_vert_dist ;
				else {
					max_height_column = Math.max(Math.max(height_1_big_right, height_1_small_center_left), Math.max(height_1_small_center_right, height_1_small_right)) ;						
					top = curr_top + max_height_column + modules_vert_dist ;
				}
				
				$('div_module_' + key).style.top = top + "px" ;
				$('div_module_' + key).style.left = curr_left_2 + "px" ;				
				
 	 			break;
			case "2_big_right":
  				
				max_height_column = Math.max(Math.max(height_1_small_center_right, height_1_small_center_left), height_1_small_right) ;
				top = curr_top + max_height_column + modules_vert_dist ;
				
				$('div_module_' + key).style.top = top + "px" ;
				$('div_module_' + key).style.left = curr_left_2 + width_modules + modules_hor_dist + "px" ;
				
 	 			break;
			case "2_small_center_left":
 				
				if (height_1_small_center_left > 0)
					top = curr_top + height_1_small_center_left + modules_vert_dist ;
				else if (height_1_big_left > 0)
					top = curr_top + height_1_big_left + modules_vert_dist ;
				else if (height_1_big_right > 0)
					top = curr_top + height_1_big_right + modules_vert_dist ;
				else {
					max_height_column = Math.max(Math.max(height_1_big_right, height_1_small_center_left), Math.max(height_1_small_center_right, height_1_small_right)) ;						
					top = curr_top + max_height_column + modules_vert_dist ;
				}
					
				$('div_module_' + key).style.top = top + "px" ;
				$('div_module_' + key).style.left = curr_left_2 + width_modules + modules_hor_dist + "px" ;
				
 	 			break;
			case "2_small_center_right":
  				
				if (height_1_small_center_right > 0)
					top = curr_top + height_1_small_center_right + modules_vert_dist ;
				else if (height_1_big_left > 0)
					top = curr_top + height_1_big_left + modules_vert_dist ;
				else if (height_1_big_right > 0)
					top = curr_top + height_1_big_right + modules_vert_dist ;
				else {
					max_height_column = Math.max(Math.max(height_1_big_right, height_1_small_center_left), Math.max(height_1_small_center_right, height_1_small_right)) ;						
					top = curr_top + max_height_column + modules_vert_dist ;
				}
					
				$('div_module_' + key).style.top = top + "px" ;
				$('div_module_' + key).style.left = curr_left_2 + 2 * (width_modules + modules_hor_dist) + "px" ;
				
 	 			break;
			case "2_small_right":
			
  				if (height_1_small_right > 0)
					top = curr_top + height_1_small_right + modules_vert_dist ;
				else if (height_1_big_right > 0)
					top = curr_top + height_1_big_right + modules_vert_dist ;
				else {
					max_height_column = Math.max(Math.max(height_1_big_left, height_1_small_center_left), Math.max(height_1_small_center_right, height_1_small_left)) ;						
					top = curr_top + max_height_column + modules_vert_dist ;
				}
					
				$('div_module_' + key).style.top = top + "px" ;
				$('div_module_' + key).style.left = curr_left_2 + 3 * (width_modules + modules_hor_dist) + "px" ;
				
 	 			break;					
			case "horiz_center_2":				
				
				top = parseInt(findPosY($("td_main_content_container"))) + td_main_content_container_height ;
				
				top -= height_horiz_center_2 ;
				//top -= modules_vert_dist ;
				
				$('div_module_' + key).style.top = top + "px" ;
				$('div_module_' + key).style.left = curr_left + "px" ;
				
 	 			break;
			case "horiz_center_1":
				
				top = parseInt(findPosY($("td_main_content_container"))) + td_main_content_container_height ;
				
				if (height_horiz_center_2 > 0) {
					top -= height_horiz_center_2 ;
					//top -= modules_vert_dist ;
				}
				top -= height_horiz_center_1 ;
				//top -= modules_vert_dist ;
				
				$('div_module_' + key).style.top = top + "px" ;
				$('div_module_' + key).style.left = curr_left + "px" ;
				
 	 			break;	
		}		
	}
	
	if (!position_modules)
		setTimeout('positioning_modules()', 500);
	position_modules = true ;
}

function revealThumbnail(id) {
	$(id).style.filter = 'alpha(opacity=100)';
	$(id).style.opacity = 1;
}

function hideThumbnail(id) {
	$(id).style.filter = 'alpha(opacity=70)';
	$(id).style.opacity = 0.7;
}

function hideThumbnail_custom(id, alpha) {
	$(id).style.filter = 'alpha(opacity=' + alpha * 100 + ')';
	$(id).style.opacity = alpha;
}

function createMarker(point, cc, text) {
	var tinyIcon = new GIcon();
	tinyIcon.image = abs_url_site + "_images/gmap_icons/a2z.png" ;
	tinyIcon.shadow = abs_url_site + "_images/gmap_icons/a2z_shadow.png" ;
			
	var iconWidth = 32 ;
	var iconHeight = 40 ;
	tinyIcon.iconSize = new GSize(iconWidth, iconHeight);
			
	var shadowWidth = 53 ;
	var shadowHeight = 40 ;
	tinyIcon.shadowSize = new GSize(shadowWidth, shadowHeight);
			
	tinyIcon.iconAnchor = new GPoint(6, 20);
	tinyIcon.infoWindowAnchor = new GPoint(5, 1);		
			
	// Set up our GMarkerOptions object
	var markerOptions = { icon:tinyIcon };	
	var marker = new GMarker(point, markerOptions) ;

	GEvent.addListener(marker, "mouseover", function() 	{
															marker.openInfoWindowHtml(text);
														});
	GEvent.addListener (marker, "click", function() { window.location = abs_url_site + 'set_country.php?country=' + cc ; });

 	return marker;
}

var map;

var zoom_level = 16 ;

function initialize() {
	if (show_map) {
		if (GBrowserIsCompatible()) {
			var zoom_level = 12 ;
			
			map = new GMap2(document.getElementById("div_map_container"));
			point = new GLatLng(location_lat, location_long) ;
			
			map.setCenter(point, zoom_level);
			
			map.setUIToDefault();
		
			map.setMapType(G_NORMAL_MAP);
			
			//map.removeMapType(G_SATELLITE_MAP);
			//map.removeMapType(G_HYBRID_MAP); 
			//map.removeMapType(G_PHYSICAL_MAP);
			//map.removeMapType(G_NORMAL_MAP);
			
			// Get the default GMapUIOptions.
			var uiOptions = map.getDefaultUI();
			// Disable scroll wheel zoom.
			uiOptions.zoom.scrollwheel = false;
			// Now set the map's UI with the tweaked options.
			map.setUI(uiOptions);
		}
	}
}

function initialize_full_map() {
	if (show_full_map) {
		if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("div_map_full_container"));
			
			var location_lat = 20 ;
			var location_long = -4.170000 ;
			var point = new GLatLng(location_lat, location_long) ;
			
			var zoom_level = 2 ;
			map.setCenter(point, zoom_level);
			
			map.setUIToDefault();
			
			map.setMapType(G_NORMAL_MAP);
			
			//map.removeMapType(G_SATELLITE_MAP);
			//map.removeMapType(G_HYBRID_MAP); 
			//map.removeMapType(G_PHYSICAL_MAP);
			//map.removeMapType(G_NORMAL_MAP);
			
			// Get the default GMapUIOptions.
			var uiOptions = map.getDefaultUI();
			// Disable scroll wheel zoom.
			uiOptions.zoom.scrollwheel = false;
			// Now set the map's UI with the tweaked options.
			map.setUI(uiOptions);			
			
			var str = "" ;
			
			for (var i = 0; i < countries_names.length; i++) {
				point = new GLatLng( parseInt(latitudes[i]), parseInt(longitudes[i]) ) ;
				str = "<span style='color:#620027'>Click here to see all escorts from<br><strong>" + countries_names[i] + "</strong></span>" ;
				
				map.addOverlay(createMarker(point, countries_codes[i], str));
			}			
		}
	}
}

var top10_ind_escorts_order = 2 ;
var top10_ag_escorts_order = 2 ;

var show_top10_ind_escorts = false ;
var show_top10_ag_escorts = false ;

function init_ind_escorts_slideshow() {
	try {
		if (show_top10_ind_escorts) {
			var parametri = "sid=" + Math.random() ;
			parametri += "&top10_ind_escorts_order=" + top10_ind_escorts_order ;
			
			//alert (parametri) ;
			var url = abs_url_site + 'next_img_ind_escorts_slideshow.php' ;
			//alert (url) ;
			var opt = {
							method: 'post',
							parameters: parametri,
							onSuccess: 	function(transport) {
											//window.location = window.location ;
											var json = transport.responseText.evalJSON();
											
											var href = abs_url_site + "independent_escorts/escort/" + json['username'] ;
											
											//alert (json['top10_order']) ;
											if (json['top10_order'] == 0)
												top10_ind_escorts_order = 1 ;
											$('img_independets_escorts').title = json['name'] ;
											$('img_independets_escorts').alt = json['name'] ;
											setTimeout("$('img_independets_escorts').src = '" + json['path'] + "'; $('span_independent_escort_name').update('" + json['name'] + "'); $('a_independets_escorts').href = '" + href + "';", 200) ;
										},
							onFailure: 	function(transport) {
											alert("Ajax Error next img ind escorts slideshow ") ;
											//alert(transport.responseText) ;
										}
			}
			new Ajax.Request(url, opt) ;
			
			
			
			if (top10_ind_escorts_order == 10)
				top10_ind_escorts_order = 1 ;
			else
				top10_ind_escorts_order++ ;		
		}
		
		
		if (show_top10_ag_escorts) {
			var parametri = "sid=" + Math.random() ;
			parametri += "&top10_ag_escorts_order=" + top10_ag_escorts_order ;
			
			//alert (parametri) ;
			var url = abs_url_site + 'next_img_ag_escorts_slideshow.php' ;
			//alert (url) ;
			var opt = {
							method: 'post',
							parameters: parametri,
							onSuccess: 	function(transport) {
											//window.location = window.location ;
											var json = transport.responseText.evalJSON();
											
											var href = abs_url_site + "independent_escorts/escort/" + json['username'] ;
											var href = abs_url_site + "agencies_escorts/agency/" + json["agency_username"] + "/escort/" + json["username"] ;
											
											//alert (json['top10_order']) ;
											$('img_ag_escorts').title = json['name'] ;
											$('img_ag_escorts').alt = json['name'] ;
											setTimeout("$('img_ag_escorts').src = '" + json['path'] + "'; $('span_ag_escort_name').update('" + json['name'] + "'); $('a_ag_escorts').href = '" + href + "';", 200) ;																
										},
							onFailure: 	function(transport) {
											alert("Ajax Error next img ag escorts slideshow ") ;
											//alert(transport.responseText) ;
										}
			}
			new Ajax.Request(url, opt) ;
			
			
			
			if (top10_ag_escorts_order == 10)
				top10_ag_escorts_order = 1 ;
			else
				top10_ag_escorts_order++ ;
		}
		
		if ( show_top10_ind_escorts || show_top10_ag_escorts )
			setTimeout("init_ind_escorts_slideshow()", 5000) ;
	} catch(err) {
		
	}
}

function show_email_ind_escort_window(escort) {
	$('iframe_email_ind_escort_window').src = abs_url_site + "_includes/_include_email_ind_escort_window_form.php?escort=" + escort  ;
	$('div_cover').show() ;
	$('div_email_ind_escort_window').show() ;
}

function show_phone_ind_escort_window(escort) {
	$('iframe_phone_ind_escort_window').src = abs_url_site + "_includes/_include_phone_ind_escort_window_form.php?escort=" + escort  ;
	$('div_cover').show() ;
	$('div_phone_ind_escort_window').show() ;
}

function show_email_ag_escort_window(agency, escort) {
	$('iframe_email_ag_escort_window').src = abs_url_site + "_includes/_include_email_ag_escort_window_form.php?agency=" + agency + "&escort=" + escort  ;
	$('div_cover').show() ;
	$('div_email_ag_escort_window').show() ;
}

function show_email_escort_ag_window(agency) {
	$('iframe_email_escort_ag_window').src = abs_url_site + "_includes/_include_email_escort_ag_window_form.php?agency=" + agency  ;
	$('div_cover').show() ;
	$('div_email_escort_ag_window').show() ;
}

function show_phone_escorts_ag_window(agency) {
	$('iframe_phone_escort_ag_window').src = abs_url_site + "_includes/_include_phone_escort_ag_window_form.php?agency=" + agency  ;
	$('div_cover').show() ;
	$('div_phone_escort_ag_window').show() ;
}

function close_details_window(id_div) {
	$('div_cover').hide() ;
	$(id_div).hide() ;
}

function validate_form_email_ind_escort() {
	///////////////////////////////////////////////////
	//	Name
	///////////////////////////////////////////////////
	var name = trim($('name').value) ;
	if (!name) {
       	myalert("Please complete the field 'Name' !!!") ;
		$('name').focus() ;	
		return ;
	}
	if (name.length > 100) {
		myalert("Please complete the field 'Name' with maxim 100 characters !!!") ;
		$('name').select() ;		
		return ;
	}
	
	///////////////////////////////////////////////////
	//	E-mail
	///////////////////////////////////////////////////
	var email = trim($('email').value) ;
	if (!email) {
       	myalert("Please complete the field 'E-mail address' !!!") ;
		$('email').focus() ;	
		return ;
	}
	if (email.length > 100) {
		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;
		$('email').select() ;		
		return ;
	}
	if (!checkemail('email')) {
		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;
		$('email').select() ;
		return ;
	}
	
	///////////////////////////////////////////////////
	//	Subject
	///////////////////////////////////////////////////
	var subject = trim($('subject').value) ;
	if (subject.length > 500) {
		myalert("Please complete the field 'Subject' with maxim 500 characters !!!") ;
		$('subject').select() ;		
		return ;
	}
	
	///////////////////////////////////////////////////
	//	Message
	///////////////////////////////////////////////////
	var message = trim($('message').value) ;
	if (!message) {
       	myalert("Please complete the field 'Message' !!!") ;
		$('message').focus() ;	
		return ;
	}
	if (message.length > 3000) {
		myalert("Please complete the field 'Message' with maxim 3000 characters !!!") ;
		$('message').select() ;		
		return ;
	}
	
	///////////////////////////////////////////////////
	//	Security code
	///////////////////////////////////////////////////
	var security_code = trim($('security_code').value) ;
	if (!security_code) {

       	myalert("Please complete the field 'Security code' !!!") ;

		$('security_code').focus() ;	

		return ;

	}

	if (security_code.length > 5) {

		myalert("Please complete the field 'Security code' with maxim 5 characters !!!") ;

		$('security_code').select() ;		

		return ;

	}

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&checked_random=" + security_code ;

	//alert (parametri) ;

	

	var url = '_verify_image_random.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										$('form_email_ind_escort').submit() ;

									} else {

										alert("Invalid security code !!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function validate_form_phone_ind_escort() {

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (!checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	$('form_phone_ind_escort').submit() ;

}


function validate_form_phone_escort_ag() {

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (!checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	$('form_phone_escort_ag').submit() ;

}



function validate_form_email_ag_escort() {

	///////////////////////////////////////////////////

	//	Name

	///////////////////////////////////////////////////

	var name = trim($('name').value) ;

	if (!name) {

       	myalert("Please complete the field 'Name' !!!") ;

		$('name').focus() ;	

		return ;

	}

	if (name.length > 100) {

		myalert("Please complete the field 'Name' with maxim 100 characters !!!") ;

		$('name').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (!checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Subject

	///////////////////////////////////////////////////

	var subject = trim($('subject').value) ;

	if (subject.length > 500) {

		myalert("Please complete the field 'Subject' with maxim 500 characters !!!") ;

		$('subject').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Message

	///////////////////////////////////////////////////

	var message = trim($('message').value) ;

	if (!message) {

       	myalert("Please complete the field 'Message' !!!") ;

		$('message').focus() ;	

		return ;

	}

	if (message.length > 3000) {

		myalert("Please complete the field 'Message' with maxim 3000 characters !!!") ;

		$('message').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Security code

	///////////////////////////////////////////////////

	var security_code = trim($('security_code').value) ;

	if (!security_code) {

       	myalert("Please complete the field 'Security code' !!!") ;

		$('security_code').focus() ;	

		return ;

	}

	if (security_code.length > 5) {

		myalert("Please complete the field 'Security code' with maxim 5 characters !!!") ;

		$('security_code').select() ;		

		return ;

	}

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&checked_random=" + security_code ;

	//alert (parametri) ;

	

	var url = '_verify_image_random.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										$('form_email_ag_escort').submit() ;

									} else {

										alert("Invalid security code !!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function validate_form_email_escort_ag() {

	///////////////////////////////////////////////////

	//	Name

	///////////////////////////////////////////////////

	var name = trim($('name').value) ;

	if (!name) {

       	myalert("Please complete the field 'Name' !!!") ;

		$('name').focus() ;	

		return ;

	}

	if (name.length > 100) {

		myalert("Please complete the field 'Name' with maxim 100 characters !!!") ;

		$('name').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (!checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Subject

	///////////////////////////////////////////////////

	var subject = trim($('subject').value) ;

	if (subject.length > 500) {

		myalert("Please complete the field 'Subject' with maxim 500 characters !!!") ;

		$('subject').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Message

	///////////////////////////////////////////////////

	var message = trim($('message').value) ;

	if (!message) {

       	myalert("Please complete the field 'Message' !!!") ;

		$('message').focus() ;	

		return ;

	}

	if (message.length > 3000) {

		myalert("Please complete the field 'Message' with maxim 3000 characters !!!") ;

		$('message').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Security code

	///////////////////////////////////////////////////

	var security_code = trim($('security_code').value) ;

	if (!security_code) {

       	myalert("Please complete the field 'Security code' !!!") ;

		$('security_code').focus() ;	

		return ;

	}

	if (security_code.length > 5) {

		myalert("Please complete the field 'Security code' with maxim 5 characters !!!") ;

		$('security_code').select() ;		

		return ;

	}

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&checked_random=" + security_code ;

	//alert (parametri) ;

	

	var url = '_verify_image_random.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										$('form_email_escort_ag').submit() ;

									} else {

										alert("Invalid security code !!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function vote(username, name) {

	//alert (username) ;

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&username=" + username ;

	//alert (parametri) ;

	

	var url = 'vote_ind_escorts.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									//window.location = window.location ;

									var json = transport.responseText.evalJSON();

										

									if (json['response'] == "ok")

										alert ("You have voted for " + name + " !!!") ;

									else if (json['response'] == "allready_voted")

										alert ("You have allready voted for " + name + " !!!") ;

									else {

										alert("Server error !!!!!") ;

										//alert(transport.responseText) ;

									}

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function vote_ag_escort(agency_username, username, name) {

	//alert (username) ;

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&username=" + username ;

	parametri += "&agency_username=" + agency_username ;

	//alert (parametri) ;

	

	var url = 'vote_ag_escorts.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									//window.location = window.location ;

									var json = transport.responseText.evalJSON();

										

									if (json['response'] == "ok")

										alert ("You have voted for " + name + " !!!") ;

									else if (json['response'] == "allready_voted")

										alert ("You have allready voted for " + name + " !!!") ;

									else {

										alert("Server error !!!!!") ;

										//alert(transport.responseText) ;

									}

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function show_write_review_ind_escort_window(escort) {

	$('iframe_write_review_ind_escort_window').src = abs_url_site + "_includes/_include_write_review_ind_escort_window_form.php?escort=" + escort  ;

	$('div_cover').show() ;

	$('div_write_review_ind_escort_window').show() ;

}



function show_write_review_ag_escort_window(agency, escort) {

	$('iframe_write_review_ag_escort_window').src = abs_url_site + "_includes/_include_write_review_ag_escort_window_form.php?agency=" + agency + "&escort=" + escort  ;

	$('div_cover').show() ;

	$('div_write_review_ag_escort_window').show() ;

}



function validate_form_write_review_ind_escort() {

	///////////////////////////////////////////////////

	//	Name

	///////////////////////////////////////////////////

	var name = trim($('name').value) ;

	if (!name) {

       	myalert("Please complete the field 'Name' !!!") ;

		$('name').focus() ;	

		return ;

	}

	if (name.length > 100) {

		myalert("Please complete the field 'Name' with maxim 100 characters !!!") ;

		$('name').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (email && !checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Date / time of visit

	///////////////////////////////////////////////////

	var date_time_visit = trim($('date_time_visit').value) ;

	if (date_time_visit.length > 100) {

		myalert("Please complete the field 'Date / time of visit' with maxim 100 characters !!!") ;

		$('date_time_visit').select() ;		

		return ;

	}

	$('date_time_visit_hidden').value = date_time_visit ;

	

	///////////////////////////////////////////////////

	//	Time spent

	///////////////////////////////////////////////////

	var time_spent = trim($('time_spent').value) ;

	if (time_spent.length > 100) {

		myalert("Please complete the field 'Time spent' with maxim 100 characters !!!") ;

		$('time_spent').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Price

	///////////////////////////////////////////////////

	var price = trim($('price').value) ;

	if (price.length > 100) {

		myalert("Please complete the field 'Price' with maxim 100 characters !!!") ;

		$('price').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Her place

	///////////////////////////////////////////////////

	var her_place = trim($('her_place').value) ;

	if (her_place.length > 500) {

		myalert("Please complete the field 'Her place' with maxim 500 characters !!!") ;

		$('her_place').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Her description

	///////////////////////////////////////////////////

	var her_description = trim($('her_description').value) ;

	if (her_description.length > 500) {

		myalert("Please complete the field 'Her description' with maxim 500 characters !!!") ;

		$('her_description').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Comments

	///////////////////////////////////////////////////

	var client_comment = trim($('client_comment').value) ;

	if (!client_comment) {

       	myalert("Please complete the field 'Comments' !!!") ;

		$('client_comment').focus() ;	

		return ;

	}

	if (client_comment.length > 3000) {

		myalert("Please complete the field 'Comments' with maxim 3000 characters !!!") ;

		$('client_comment').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Security code

	///////////////////////////////////////////////////

	var security_code = trim($('security_code').value) ;

	if (!security_code) {

       	myalert("Please complete the field 'Security code' !!!") ;

		$('security_code').focus() ;	

		return ;

	}

	if (security_code.length > 5) {

		myalert("Please complete the field 'Security code' with maxim 5 characters !!!") ;

		$('security_code').select() ;		

		return ;

	}

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&checked_random=" + security_code ;

	//alert (parametri) ;

	

	var url = '_verify_image_random.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										$('form_write_review_ind_escort').submit() ;

									} else {

										alert("Invalid security code !!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function validate_form_write_review_ag_escort() {

	///////////////////////////////////////////////////

	//	Name

	///////////////////////////////////////////////////

	var name = trim($('name').value) ;

	if (!name) {

       	myalert("Please complete the field 'Name' !!!") ;

		$('name').focus() ;	

		return ;

	}

	if (name.length > 100) {

		myalert("Please complete the field 'Name' with maxim 100 characters !!!") ;

		$('name').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (email && !checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Date / time of visit

	///////////////////////////////////////////////////

	var date_time_visit = trim($('date_time_visit').value) ;

	if (date_time_visit.length > 100) {

		myalert("Please complete the field 'Date / time of visit' with maxim 100 characters !!!") ;

		$('date_time_visit').select() ;		

		return ;

	}

	$('date_time_visit_hidden').value = date_time_visit ;

	

	///////////////////////////////////////////////////

	//	Time spent

	///////////////////////////////////////////////////

	var time_spent = trim($('time_spent').value) ;

	if (time_spent.length > 100) {

		myalert("Please complete the field 'Time spent' with maxim 100 characters !!!") ;

		$('time_spent').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Price

	///////////////////////////////////////////////////

	var price = trim($('price').value) ;

	if (price.length > 100) {

		myalert("Please complete the field 'Price' with maxim 100 characters !!!") ;

		$('price').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Her place

	///////////////////////////////////////////////////

	var her_place = trim($('her_place').value) ;

	if (her_place.length > 500) {

		myalert("Please complete the field 'Her place' with maxim 500 characters !!!") ;

		$('her_place').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Her description

	///////////////////////////////////////////////////

	var her_description = trim($('her_description').value) ;

	if (her_description.length > 500) {

		myalert("Please complete the field 'Her description' with maxim 500 characters !!!") ;

		$('her_description').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Comments

	///////////////////////////////////////////////////

	var client_comment = trim($('client_comment').value) ;

	if (!client_comment) {

       	myalert("Please complete the field 'Comments' !!!") ;

		$('client_comment').focus() ;	

		return ;

	}

	if (client_comment.length > 3000) {

		myalert("Please complete the field 'Comments' with maxim 3000 characters !!!") ;

		$('client_comment').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Security code

	///////////////////////////////////////////////////

	var security_code = trim($('security_code').value) ;

	if (!security_code) {

       	myalert("Please complete the field 'Security code' !!!") ;

		$('security_code').focus() ;	

		return ;

	}

	if (security_code.length > 5) {

		myalert("Please complete the field 'Security code' with maxim 5 characters !!!") ;

		$('security_code').select() ;		

		return ;

	}

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&checked_random=" + security_code ;

	//alert (parametri) ;

	

	var url = '_verify_image_random.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										$('form_write_review_ag_escort').submit() ;

									} else {

										alert("Invalid security code !!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function see_review(review) {

	//alert (review) ;

	$('iframe_write_review_ind_escort_window').src = abs_url_site + "_includes/_include_see_review_ind_escort.php?review=" + review  ;

	$('div_cover').show() ;

	$('div_write_review_ind_escort_window').show() ;

}



function see_ag_esc_review(review) {

	//alert (review) ;

	$('iframe_write_review_ag_escort_window').src = abs_url_site + "_includes/_include_see_review_ag_escort.php?review=" + review  ;

	$('div_cover').show() ;

	$('div_write_review_ag_escort_window').show() ;

}



function validate_form_escort_employment() {

	///////////////////////////////////////////////////

	//	Name

	///////////////////////////////////////////////////

	var name = trim($('name').value) ;

	if (!name) {

       	myalert("Please complete the field 'Your name' !!!") ;

		$('name').focus() ;	

		return ;

	}

	if (name.length > 100) {

		myalert("Please complete the field 'Your name' with maxim 100 characters !!!") ;

		$('name').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Telephone

	///////////////////////////////////////////////////

	var telephone = trim($('telephone').value) ;

	if (!telephone) {

       	myalert("Please complete the field 'Telephone' !!!") ;

		$('telephone').focus() ;	

		return ;

	}

	if (telephone.length > 100) {

		myalert("Please complete the field 'Telephone' with maxim 100 characters !!!") ;

		$('telephone').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (email && !checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Security code

	///////////////////////////////////////////////////

	var security_code = trim($('security_code').value) ;

	if (!security_code) {

       	myalert("Please complete the field 'Security code' !!!") ;

		$('security_code').focus() ;	

		return ;

	}

	if (security_code.length > 5) {

		myalert("Please complete the field 'Security code' with maxim 5 characters !!!") ;

		$('security_code').select() ;		

		return ;

	}

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&checked_random=" + security_code ;

	//alert (parametri) ;

	

	var url = abs_url_site + '_includes/_verify_image_random.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										//alert(transport.responseText) ;

										$('form_escort_employment').submit() ;

									} else {

										alert("Invalid security code !!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									//alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function validate_form_agency_listing() {

	///////////////////////////////////////////////////

	//	Name

	///////////////////////////////////////////////////

	var name = trim($('name').value) ;

	if (!name) {

       	myalert("Please complete the field 'Agency name' !!!") ;

		$('name').focus() ;	

		return ;

	}

	if (name.length > 100) {

		myalert("Please complete the field 'Agency name' with maxim 100 characters !!!") ;

		$('name').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Telephone

	///////////////////////////////////////////////////

	var telephone = trim($('telephone').value) ;

	if (!telephone) {

       	myalert("Please complete the field 'Telephone' !!!") ;

		$('telephone').focus() ;	

		return ;

	}

	if (telephone.length > 100) {

		myalert("Please complete the field 'Telephone' with maxim 100 characters !!!") ;

		$('telephone').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (email && !checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Security code

	///////////////////////////////////////////////////

	var security_code = trim($('security_code').value) ;

	if (!security_code) {

       	myalert("Please complete the field 'Security code' !!!") ;

		$('security_code').focus() ;	

		return ;

	}

	if (security_code.length > 5) {

		myalert("Please complete the field 'Security code' with maxim 5 characters !!!") ;

		$('security_code').select() ;		

		return ;

	}

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&checked_random=" + security_code ;

	//alert (parametri) ;

	

	var url = abs_url_site + '_includes/_verify_image_random.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										//alert(transport.responseText) ;

										$('form_agency_listing').submit() ;

									} else {

										alert("Invalid security code !!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									//alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function validate_form_photographers() {

	///////////////////////////////////////////////////

	//	Name

	///////////////////////////////////////////////////

	var name = trim($('name').value) ;

	if (!name) {

       	myalert("Please complete the field 'Your name' !!!") ;

		$('name').focus() ;	

		return ;

	}

	if (name.length > 100) {

		myalert("Please complete the field 'Your name' with maxim 100 characters !!!") ;

		$('name').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Telephone

	///////////////////////////////////////////////////

	var telephone = trim($('telephone').value) ;

	if (!telephone) {

       	myalert("Please complete the field 'Telephone' !!!") ;

		$('telephone').focus() ;	

		return ;

	}

	if (telephone.length > 100) {

		myalert("Please complete the field 'Telephone' with maxim 100 characters !!!") ;

		$('telephone').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (email && !checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Security code

	///////////////////////////////////////////////////

	var security_code = trim($('security_code').value) ;

	if (!security_code) {

       	myalert("Please complete the field 'Security code' !!!") ;

		$('security_code').focus() ;	

		return ;

	}

	if (security_code.length > 5) {

		myalert("Please complete the field 'Security code' with maxim 5 characters !!!") ;

		$('security_code').select() ;		

		return ;

	}

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&checked_random=" + security_code ;

	//alert (parametri) ;

	

	var url = abs_url_site + '_includes/_verify_image_random.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										//alert(transport.responseText) ;

										$('form_photographers').submit() ;

									} else {

										alert("Invalid security code !!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									//alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function validate_form_contact() {

	///////////////////////////////////////////////////

	//	Name

	///////////////////////////////////////////////////

	var name = trim($('name').value) ;

	if (!name) {

       	myalert("Please complete the field 'Your name' !!!") ;

		$('name').focus() ;	

		return ;

	}

	if (name.length > 100) {

		myalert("Please complete the field 'Your name' with maxim 100 characters !!!") ;

		$('name').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Telephone

	///////////////////////////////////////////////////

	var telephone = trim($('telephone').value) ;

	if (!telephone) {

       	myalert("Please complete the field 'Telephone' !!!") ;

		$('telephone').focus() ;	

		return ;

	}

	if (telephone.length > 100) {

		myalert("Please complete the field 'Telephone' with maxim 100 characters !!!") ;

		$('telephone').select() ;		

		return ;

	}

	

	///////////////////////////////////////////////////

	//	E-mail

	///////////////////////////////////////////////////

	var email = trim($('email').value) ;

	if (!email) {

       	myalert("Please complete the field 'E-mail address' !!!") ;

		$('email').focus() ;	

		return ;

	}

	if (email.length > 100) {

		myalert("Please complete the field 'E-mail address' with maxim 100 characters !!!") ;

		$('email').select() ;		

		return ;

	}

	if (email && !checkemail('email')) {

		myalert("Please complete the field 'E-mail address' with a valid e-mail address !!!") ;

		$('email').select() ;

		return ;

	}

	

	///////////////////////////////////////////////////

	//	Message

	///////////////////////////////////////////////////

	var message = trim($('message').value) ;

	if (!message) {

       	myalert("Please complete the field 'Message' !!!") ;

		$('message').focus() ;	

		return ;

	}

	if (message.length > 30000) {

		myalert("Please complete the field 'Message' with maxim 30000 characters !!!") ;

		$('message').select() ;		

		return ;

	}





	///////////////////////////////////////////////////

	//	Security code

	///////////////////////////////////////////////////

	var security_code = trim($('security_code').value) ;

	if (!security_code) {

       	myalert("Please complete the field 'Security code' !!!") ;

		$('security_code').focus() ;	

		return ;

	}

	if (security_code.length > 5) {

		myalert("Please complete the field 'Security code' with maxim 5 characters !!!") ;

		$('security_code').select() ;		

		return ;

	}

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&checked_random=" + security_code ;

	//alert (parametri) ;

	

	var url = abs_url_site + '_includes/_verify_image_random.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										//alert(transport.responseText) ;

										$('form_contact').submit() ;

									} else {

										alert("Invalid security code !!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error check security code !!!!!") ;

									//alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function change_country(cc) {

	//alert (cc) ;

	var parametri = "sid=" + Math.random() ;

	parametri += "&cc=" + cc ;

	//alert (parametri) ;

	

	var url = abs_url_site + '_includes/_set_country.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										//window.location = window.location ;

										window.location = abs_url_site + 'country' ;										

									} else {

										alert("Error change country!!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error change country!!!!!") ;

									//alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function change_city(city) {

	//alert (city) ;	

	var parametri = "sid=" + Math.random() ;

	parametri += "&city=" + city ;

	//alert (parametri) ;

	

	var url = abs_url_site + '_includes/_set_city.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										window.location = abs_url_site + 'country' ;

									} else {

										alert("Error change city!!!!!") ;

										//alert(transport.responseText) ;

									}										

								},

					onFailure: 	function(transport) {

									alert("Ajax Error change city!!!!!") ;

									//alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



var add_more_escorts = false ;	



function show_more_escorts(as) {	

	var parametri = "sid=" + Math.random() ;

	//alert (parametri) ;

	

	var url = abs_url_site + '_includes/add_more_escorts.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {									

									var json = transport.responseText.evalJSON();

										

									//alert ('responde => ' + json['responde']) ;

									//alert ('ind_esc_searched => ' + json['ind_esc_searched']) ;

									//alert ('selected_country_code => ' + json['selected_country_code']) ;

									//alert ('selected_city_unique_id => ' + json['selected_city_unique_id']) ;

									//alert ('inf_limit => ' + json['inf_limit']) ;

									//alert ('sup_limit => ' + json['sup_limit']) ;

									//alert ('record_count => ' + json['record_count']) ;

									//alert ('sql => ' + json['sql']) ;	

									//alert ('new_record_count => ' + json['new_record_count']) ;									

									

										

									if (json['responde'] == "finish") {

										add_more_escorts = false ;

									} else if (json['responde'] == "ok") {

										var tmp_str = $('td_ind_escorts_container_to_update').innerHTML ;

										tmp_str += json['text'] ;

										$('td_ind_escorts_container_to_update').update(tmp_str) ;

										divs_containers_heights['div_module_ind_escorts'] = getHeight('div_module_ind_escorts', true, true) ;

										position_modules = true ;

										positioning_modules() ;

										//alert (json['text']) ;

									} else {

										add_more_escorts = false ;

									}									

								},

					onFailure: 	function(transport) {

									alert("Ajax Error add_more_escorts !!!!!") ;

									//alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

	

	if (add_more_escorts)

		setTimeout("show_more_escorts(abs_url_site)", 500) ;

}



function change_usa_state(state) {

	var parametri = "sid=" + Math.random() ;

	parametri += "&state=" + state ;

	//alert (parametri) ;

	

	var url = abs_url_site + '_includes/_set_state.php' ;

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									if (transport.responseText == "ok") {

										window.location = abs_url_site + 'country' ;

									}

								},

					onFailure: 	function(transport) {

									alert("Ajax Error change state!!!!!") ;

									//alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;

}



function change_span_cities(country_code) {

	//alert(country_code) ;

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&country_code=" + country_code ;

	//alert (parametri) ;

	

	var url = '' ;

	var opt = Array() ;

	

	if (country_code == "us") {

		url = 'http://a2zescorts.com/_includes/change_span_states.php' ;

		

		opt = 		{

						method: 'post',

						parameters: parametri,

						onSuccess: 	function(transport) {

										//window.location = window.location ;

										//alert(transport.responseText) ;

										$('span_cities_or_states').update(transport.responseText) ;															

									},

						onFailure: 	function(transport) {

										alert("Ajax Error change country states !!!!!") ;

										alert(transport.responseText) ;

									}

					}

					

		new Ajax.Request(url, opt) ;	

	} else {

		url = 'http://a2zescorts.com/_includes/change_span_cities.php' ;

		

		opt = 	{

						method: 'post',

						parameters: parametri,

						onSuccess: 	function(transport) {

										//window.location = window.location ;

										//alert(transport.responseText) ;

										$('span_cities_or_states').update(transport.responseText) ;	

										$('span_usa_states').update('') ;

									},

						onFailure: 	function(transport) {

										alert("Ajax Error change country cities !!!!!") ;

										alert(transport.responseText) ;

									}

					}	

		new Ajax.Request(url, opt) ;	

	}	

}



function change_span_usa_cities(usa_state) {

	

	var parametri = "sid=" + Math.random() ;

	parametri += "&usa_state=" + usa_state ;

	

	var url = 'http://a2zescorts.com/_includes/change_span_usa_cities.php' ;

		

	var opt = 	{

					method: 'post',

					parameters: parametri,

					onSuccess: 	function(transport) {

									//window.location = window.location ;

									//alert(transport.responseText) ;

									$('span_usa_states').update(transport.responseText) ;															

								},

					onFailure: 	function(transport) {

									alert("Ajax Error change USA state cities !!!!!") ;

									alert(transport.responseText) ;

								}

				}	

	new Ajax.Request(url, opt) ;	

}