		
		var first=1;
		function city_move(cityes,move_direction)	{
		$("ul.city-list li").hide();
		
		$("#city_left").show();
		$("#city_right").show();
			if (move_direction=='right' && (first+9)<cityes) first=first+1;
			if (move_direction=='left' && first>1) first=first-1;
			for (i=first;i<=(first+8);i++) {
				$("#city_id_"+i).show();
			}
		menu_center();
		};
		


var float_on=0;
function getElementsByNameIE(tag, name) {
     
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}
function check_float()
{	window.event.cancelBubble=true;
	if (
	((window.event.keyCode >=48)&&(window.event.keyCode<=57)||(window.event.keyCode==46))
	) 
	return true
	else return false;
}
function check_number()
{	window.event.cancelBubble=true;
	if ((window.event.keyCode >=48) && (window.event.keyCode<=57)) return true
	else return false;
}
function tabActivate(id,tn)
{
	var tabs = document.getElementsByName(tn);

		for(var i=0;i<tabs.length;i++){
			tabs[i].className = '';
			tabs[i].style.cursor = 'pointer';
		}
		
		document.getElementById(id).className = 'active';
}
function tabActivate_info(id,tn)
{
	var tabs = getElementsByNameIE('a',tn);
	var tabs_detail = getElementsByNameIE('div',tn+"_detail");
		for(var i=0;i<tabs.length;i++){
			tabs[i].className = '';
			tabs[i].style.cursor = 'pointer';
		}

		for(var i=0;i<tabs_detail.length;i++){
			tabs_detail[i].className = 'item-box-hide';
		}

		document.getElementById(id+'_detail').className = 'item-box';
		document.getElementById(id).className = 'active';
		
		if (id=='tab5')
		{
			$("#main_photo_block").hide();
			$("#main_video_block").show();
		}
		else
		{
			$("#main_photo_block").show();
			$("#main_video_block").hide();
		}
		
}



var im;
//$(document).ready(function(){
	//$('#info1 a').tooltip({track:true,delay:0,showURL:false})
//});

function security_img()
{
document.getElementById('security_img').src=document.getElementById('security_img').src+'&'+ Math.random();
}

function ShowImg()
{
	$('#main_photo').attr("src",im.src);
	//$('#main_photo').width(im.width);
	//$('#big_photo').height(im.height)
}

function ChangePhoto(a){
	$('#main_photo').attr("src","/img/loader.gif");
	//$('#big_photo').width(300);$('#big_photo').height(400);
	im=new Image();
	im.src="/users_photo/500/"+a;
	if(!im.complete){ im.onload=ShowImg } else {ShowImg()}
}

function addCookie(Name,Value)
{
var dtExpires=new Date();
var dtExpiryDate="";
dtExpires.setTime(dtExpires.getTime()+100*24*60*60*10000);
dtExpiryDate = dtExpires.toGMTString();
document.cookie=Name+"="+Value+"; expires="+dtExpiryDate+"; path=/;";
//alert("Добавлено: "+Name+" = "+Value);
}

function security_img()
{
document.getElementById('security_img').src=document.getElementById('security_img').src+'&'+ Math.random();
}


function Off(){ float_on=0; $("#img").attr("src","/img/loader.gif");  $("#info").hide();$(document).unbind()}



function ShowImg_main(){$("#photo_div").html("<img id=\"img\" class=\"border_img\" src=\""+im.src+"\">")}
function On(id,url,name,price_h,price_2h,price_n,height,age,boobs_size,huy,tel,inew,atype,real_photo,ivideo,cm_count,v_t,v_a)
{
	im=new Image();
	//im.src="/users_photo/250/"+url+"";
	url=""+url.replace("\/90","\/250")+"";
	url=""+url.replace("\/170","\/250")+"";
	im.src=""+url+"";
	//alert(im.src.indexOf("\/90"));
	if(!im.complete){im.onload=ShowImg_main} else{ShowImg_main()}
	$("#name").html(name);
	if(height==0){$("#info_height").hide()} else{$("#info_height").show();$("#height").html(height)}$("#age").html(age);

	if(boobs_size==0){$("#info_boobs_size").hide()} else {$("#info_boobs_size").show();$("#boobs_size").html(boobs_size)}
	if(huy==0){$("#info_huy_size").hide()} else {$("#info_huy_size").show();$("#huy_size").html(huy+' см')}
	if(price_2h==0){$("#info_price2").hide()}else{$("#info_price2").show();$("#price_2h").html(price_2h+' USD')}
	if(price_n==0){$("#info_price3").hide()}else{$("#info_price3").show();$("#price_n").html(price_n+' USD')}
	if(cm_count>0){$("#cm_count").show();$("#cm_count_inner").html(cm_count)}else{$("#cm_count").hide()}
	if(inew==1)$("#icon_new").show();else $("#icon_new").hide();
	if(atype==1)$("#icon_vip").show();else $("#icon_vip").hide();
	if(atype==2)$("#icon_vip_plus").show();else $("#icon_vip_plus").hide();
	if(ivideo==1)$("#icon_video").show();else  $("#icon_video").hide();
	if(real_photo==1)$("#icon_real").show();else  $("#icon_real").hide();
	if(price_h==0) $("#price_h").html('по настроению'); else $("#price_h").html(price_h+' USD');
	$("#tel").html(tel);
	$("#views_t").html(v_t);
	$("#views_a").html(v_a);
	
	if (atype==1) float_on=id;
	if (atype==2) float_on=id;

$(document).mousemove(function(e){
		document.getElementById("info").style.left=((e.clientX+385<$(window).width())?e.pageX+15:e.pageX-385-15)+"px";
		document.getElementById("info").style.top=((e.clientY+270<$(window).height())?e.pageY+15:e.pageY-270-15)+"px"
		//document.getElementById("svcs_data").style.left='100px';
	});

$("#info").show()
}

function get_comments_list(id)
{
	$.ajax({
	  url: '/inc/ajax/comments_list.php?id='+id,
	  success: function(data) {
	    $('#comments_list').html(data);
	  }
	});
};

$(document).ready(function(){
	$(".item-box img").bind("mouseout",function(){Off()});
})



function MM_preloadImages() {
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,arr=MM_preloadImages.arguments; for(i=0; i<arr.length; i++)
	if (arr[i].indexOf('#')!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=arr[i];}}
}

function ChangeImg(img, id)
{
	setTimeout('$("#g'+id+'").attr("src","'+img+'")', 500);
	//if(jQuery.browser.version != "6.0"){
	$('#g'+id).fadeTo(500, 0.1);
	$('#g'+id).fadeTo(500, 1);
//	}
}

function ChangeImg_float(img, id)
{
	setTimeout('$("#'+id+'").attr("src","'+img+'")', 500);
	//if(jQuery.browser.version != "6.0"){
	$('#'+id).fadeTo(500, 0.1);
	$('#'+id).fadeTo(500, 1);
//	}
}

function get_cityes()
{
	var summ_width=0;
	$("ul#city-list li").each(function(tt){
	if (jQuery.css(this,"display") != "none") summ_width=summ_width+$(this).width();
		
	});
	return summ_width;
}
function menu_center()
{
	var block_menu=get_cityes();
	var city_menu=document.getElementById('city_menu').offsetWidth;
	document.getElementById('city-list').style.paddingLeft = ((city_menu-block_menu)/2)+'px';
	//alert(city_menu+'|'+block_menu+'|'+((city_menu-block_menu)/2));
}

 function popDown(){
        dS=document.getElementById('ht1').style;
        dS.visibility='hidden';
 }

 function popUp(evt,num,type){
        d=document.getElementById('ht1');
        dS=d.style;
		if (type=='img') num='<img src="'+num+'" border="0">';
        d.innerHTML=num;
	if (!evt) var evt = window.event;
	if (evt.pageX || evt.pageY)
	{
		offLeft = evt.pageX;
		offTop = evt.pageY;
	}
	else if (evt.clientX || evt.clientY)
	{
		offLeft = evt.clientX + document.documentElement.scrollLeft;
		offTop = evt.clientY + document.documentElement.scrollTop;
	}
		

        dS.top=offTop+10+"px";
        dS.left=offLeft+15+"px";
        dS.visibility='visible';
}

function AddComment(anketa_id) {
		if(($("#user_name").val()!="")&&($("#com_txt").val()!=""))
			{
				var mark1,mark2,mark3;
				mark1=$("#mark1").val();
				mark2=$("#mark2").val();
				mark3=$("#mark3").val();
				
				$.ajax({
				   type: "POST",
				   url: "/inc/ajax/comment_add.php",
				   data: "securityCode="+$("#security").val()+"+&anketa_id="+anketa_id+"&mark1="+mark1+"&mark2="+mark2+"&mark3="+mark3+"&user_name="+$("#user_name").val()+"&com_txt="+$("#com_txt").val()+"&city_id="+$("#city_id").val(),
				   success: function(msg){
				     if (msg) {
					 	alert(msg)
					 }
					 else
					 {
						 $("#comment")[0].reset();
						 $('#add_comment').hide();
						 get_comments_list(anketa_id);
						 $('#comments_list').show();
						
						
					 }
				   }
				 });				
			}
			else
			{
			alert('Отзыв не написан!');
			}
	}
function goto_page(url)
{
	self.location.href=url;
}	
function show_modal (id_form) { 			
        $.blockUI({ 
			
            message: $('#'+id_form), 
            css: { 
                top:  ($(window).height() - 400) /2 + 'px', 
                left: ($(window).width() - 400) /2 + 'px', 
                width: '400px' 
            }, 
			overlayCSS: {
				backgroundColor: '#588DB9',
				opacity:	  	 0.90
			}
        }); 
 
 		//$('.blockOverlay').attr('title','Click to unblock').click($.unblockUI);
        //setTimeout($.unblockUI, 2000); 
}
function close_modal()
{
	setTimeout($.unblockUI, 2); 
}

function get_form18()
{
	$.ajax({
	  url: '/inc/ajax/form18.php',
	  success: function(data) {
	    $('#form18').html(data);
	  }
	});
};
function echo_rating(cid,rating,votes)
{
	$('#rating').rater('/inc/ajax/rating.php?cid='+cid+'&'+ Math.random(), {maxvalue:5, style: 'basic', curvalue:rating});
	$('#rating').append('рейтинг - '+rating+'&nbsp;&nbsp; проголосовало - '+votes);
}
