//
// metro
//

var metros = new Array();

function metro_update_array(e){
  metros  = e;
  var metros_string = "";
  for(var i = 0; i < metros.length; i++){
    metros_string += metros[i] + ',';
  }
  $('#metro_select_num').html(metros.length);
  if ($('#id_metros').length){
    $('#id_metros').val(metros_string);
  } else {
    $('<input>').attr({
      type: 'hidden',
      id: 'id_metros',
      name: 'metros',
      value: metros_string
    }).appendTo('form');
  }
}

function metro_get_array(e){
  return metros;
}

$(document).ready(function(){
  if ($("#search_form_id").length && $("select#city_name").length){
    var city = $("select#city_name").val();
    display_metro(city);
  }
	$(".gallery").prettyPhoto();
	$(".balloon_caption").balloon();
});

$(function(){

  $('#metro_confirm').click(function(){
    for(var i = 0; i < metros.length; i++){
      alert(metros[i]);
    }
    return false; 
  });

  $('#metro_select').click(function(){
    var city_id = $('#city_name').val().split('_');
    city_id = city_id[2];

    if (city_id != '2992300' && city_id != '101'){
      alert("message to replace: 'у данного города нет метро' ");
      return false;
    }

    var url = "metro_select.php" + "?city_id=" + city_id;
    var width  = 830;
    var height = 700;
    var left   = (screen.width  - width)/2;
    var top    = (screen.height - height)/2;
    var params = 'width='+width+', height='+height;
    params += ', top='+top+', left='+left;
    params += ', directories=no';
    params += ', location=no';
    params += ', menubar=no';
    params += ', resizable=no';
    params += ', scrollbars=yes';
    params += ', status=no';
    params += ', toolbar=no';
    newwin = window.open(url, 'metro', params);
      //if (window.focus) {newwin.focus()}
    return false; 
  });

});

var g_PopupIFrame;

function get_scroll(){
	if (self.pageYOffset) {
		return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
	} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
		return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
	} else if (document.body) {// all other Explorers
		return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
	};
};

//
// Gallery's balloon caption
//

(function($) {
	$.balloon = {version: '1.0.0'};
	$.fn.balloon = function(){
		var balloon_settings = jQuery.extend({
		theme: 'ballon',
		callback: function(){},
		markup: '<div class="balloon_style" id="balloon_caption"> \
      <table><tr><td valign=top><i style="font-size:86%;">{caption}</i> \
      </td></tr></table></div>'
		}, balloon_settings);
		
		// Global variables accessible only by prettyPhoto
		var matchedObjects = this, title;

		matchedObjects.each(function(){

			$(this).hover(function(){
				$.balloon.open($(this));
			}, function() {
				$.balloon.close($(this));
			});

		});

		/*
		*  Open balloon
		*/
		$.balloon.open = function(e){
			var offset = e.offset();
			title = $("a", e).attr('title');
			e.css("z-index", "2");
			$("a", e).attr('title', '');
			e.append("<div id='bal'>"+ title +"</div>");		
			$("#bal")
				.attr("class", "balloon_msg")
				.css("top", "60px")
				.css("left", "50px");
		};

		/**
		* Close balloon
		*/
		$.balloon.close = function(e){
			e.css("z-index", "1");
			$("a", e).attr('title', title);
			$("#bal").hide();	
			$("#bal").remove();	
		};

		//return this.unbind('click.balloon').bind('click.balloon',$.balloon.initialize);
		return false;

	};
})(jQuery);

(function($) {
	$.prettyPhoto = {version: '3.0.2'};
	$.fn.prettyPhoto = function(){
		var pp_settings = jQuery.extend({
		counter_separator_label: '/',
		theme: 'facebook',
		hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
		callback: function(){}, /* Called when prettyPhoto is closed */
		markup: '<div class="pp_overlay"></div> \
				<div class="pp_pic_holder"> \
					<div class="ppt">&nbsp;</div> \
					<div class="pp_top"> \
						<div class="pp_left"></div> \
						<div class="pp_middle"></div> \
						<div class="pp_right"></div> \
					</div> \
					<div class="pp_content_container"> \
						<div class="pp_left"> \
						<div class="pp_right"> \
							<div class="pp_content" > \
								<a class="pp_previous" id="ico_prev" title="Предыдущая страница" href="#">prev</a> \
								<a class="pp_next" id="ico_next" title="Следующая страница" href="#">next</a> \
								<div class="pp_thumbs">thumbs</div> \
								<div class="pp_loaderIcon"></div> \
								<div class="pp_fade"> \
									<div id="pp_title"><strong>Фотография 5</strong></div> \
									<div id="pp_full_res"><img id="pp_full_res_img" src="/pics/0.gif" width="100" height="100" /> \
											<div id="hidden_about_passwd"> \
											<table style="padding: 16px;"> \
											<tr><td style="text-align:left; font-size: 100%"> \
												Данная фотография защищена автором от общего просмотра паролем.</td></tr> \
											<tr><td style="text-align:left; font-size: 120%; padding-top:16px;"> \
											<div id="bad_pass">Неверный пароль.</div> \
											<form action="/hidden_photos.php" method="post" name="forma"> \
											<input name="action" value="post" type="hidden" /> \
											Введите пароль доступа к скрытым фотографиям пользователя:<br /> \
											<table style="margin-top:16px;"> \
											<tr><td><input type="text" name="hp_passwd" value="" id="passin" /></td> \
											<td><input type="image" src="/pics/11/b_next.png" id="button_next_submit" name="tsubmit" alt="Продолжить" title="Продолжить" /></td> \
											</td></tr></table></form></td></tr></table> \
											</div> \
									</div> \
									<div class="pp_details clearfix"> \
										<p class="currentTextHolder">0/0</p> \
										<a class="pp_close" href="#">Close</a> \
										<div class="pp_orig_container"> \
											Оригинал <a target="_blank" class="pp_orig" href="#">___x___</a> \
										</div> \
									</div> \
								</div> \
							</div> \
						</div> \
						</div> \
					</div> \
					<div class="pp_bottom"> \
						<div class="pp_left"></div> \
						<div class="pp_middle"></div> \
						<div class="pp_right"></div> \
					</div> \
				</div>'
		}, pp_settings);
		
		// Global variables accessible only by prettyPhoto
		var matchedObjects = this, percentBased = false, userOid, oid, offset, photo_current, cur_oid;

		/**
		* Initialize prettyPhoto.
		*/
		$.prettyPhoto.initialize = function(){
			settings = pp_settings;
			if($.browser.msie && parseInt($.browser.version) == 6) settings.theme = "light_square"; // Fallback to theme for IE6

			var curId = $(this).attr('id');
			var regexp = /userOid_(\d+)_oid_(\d+)_offset_(\d+)/;

			userOid = Number(curId.match(regexp)[1]);
			oid = Number(curId.match(regexp)[2]);
			offset = Number(curId.match(regexp)[3]);

			cur_oid = oid;
			$.prettyPhoto.open();
			return false;
		};

		/*
		*  Open our gallery
		*/
		$.prettyPhoto.open = function(event){

			$('body').append(pp_settings.markup); // Inject the markup

			$(".pp_pic_holder").attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme

			$(".pp_overlay").css({
				'display': 'block',
				'background-color':'black',
				'position':'absolute',
				'opacity':0.65,
				'height':$(document).height(),
				'width':$(window).width()
			});

			// Assign click events
			$(".pp_overlay").click(function(){ $.prettyPhoto.close(); });
			$(".pp_close").click(function(){ $.prettyPhoto.close(); return false; });
			$("#ico_next").click(function(){
				offset += 5;
				cur_oid = oids[offset];
				$.prettyPhoto.load_thumbs();
				return false;
			});
			$("#ico_prev").click(function(){
				cur_oid = oids[offset-1];
				offset -= 5;
				$.prettyPhoto.load_thumbs();
				return false;
			});
			$("#pp_full_res_img").click(function(){
				var indx = jQuery.inArray(cur_oid, oids);
				indx += 1;

				if (!oids[indx]){
					cur_oid = oids[0];
					offset = 0;
					$.prettyPhoto.load_thumbs();
					return false;
				}

				if (indx % 5 == 0 && indx != 0){
					offset += 5;
					cur_oid = oids[offset];
					$.prettyPhoto.load_thumbs();
				} else {
					$.prettyPhoto.show_photo(oids[indx]);
				}
				return false;
			});
			$("#button_next_submit").click(function(){
				$.getJSON("/hidden_photos.php",
					{
						action: 'ENTER_PASSWD',
						hp_passwd: $("#passin").val(),
						uoid: cur_user_oid,
						ajax: '1'
					},
					function(data){
						var passwd_is_ok = 0;
						$.each(data, function(key, val){
							if (key == 'wrong_pass' && val == 1){
								$("#bad_pass").show();
								return false; // break
							}
							if (key == 'wrong_pass' && val == 0){
								passwd_is_ok = 1;
								descr = [];
								width = [];
								height = [];
								url = [];
								url_small = [];
								oids = [];
								orig_size = [];
							}
							if (key == 'photos'){  // fill photo arrays
								$.each(val, function(){
									descr.push(this.descr);
									width.push(this.width);
									height.push(this.height);
									url.push(this.url);
									url_small.push(this.url_small);
									oids.push(this.oids);
									orig_size.push(this.orig_size);
								});
							}
						});

					if (passwd_is_ok == 1){
						$.prettyPhoto.show_photo(cur_oid);
					}

				});
				return false;
			});

			var scroll_pos = get_scroll();
			var windowWidth = $(window).width();
			var windowHeight = $(window).height();
			var projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (650/2));

			if (projectedTop < 0) projectedTop = 0;

			$(".pp_pic_holder").css({
				'display': 'block',
				'top': projectedTop,
				'left': (windowWidth/2) - (560/2),
				'width' : 560
			});

			$(".pp_fade").css({
				'display': 'block'
			});
			$(".pp_description").css({
				'display': 'block'
			});
			$(".pp_content").css({
				'height': '600px'
			});

			$.prettyPhoto.load_thumbs();
		};

		/**
		* Close gallery
		*/
		$.prettyPhoto.close = function(){
			$('.pp_overlay').hide();
			$('.pp_pic_holder').hide();
			$('.pp_overlay').remove();
			$('.pp_pic_holder').remove();
		};

		/**
		* Load thumbs
		*/
		$.prettyPhoto.load_thumbs = function(){
			$(".pp_thumbs").html("");
			if (oids.length > offset + 5){
				$(".pp_next").show();
			} else {
				$(".pp_next").hide();
			}
			if (offset > 0){
				$(".pp_previous").show();
			} else {
				$(".pp_previous").hide();
			}

			var class_type = "";
	
			for (var i = offset; i < offset + 5; i++){
				class_type = 'thumb';
				if (oids[i]){
					if (oids[i] == cur_oid){
						if (gender == 'F'){
							class_type = 'selected_f';
						} else {
							class_type = 'selected_m';
						}
					}
					$("<img />", {
						id: "thumb_" + oids[i],
						"class": class_type,
						src: url_small[i],
						title: descr[i],
						alt: descr[i],
						width: 80,
						height: 80,
						click: function(e){
							var oid = this.id;
							oid = oid.replace('thumb_', '');
							$.prettyPhoto.show_photo(oid);
						}
					}).appendTo(".pp_thumbs");
				}	else {
					break;
				}
			}
			$.prettyPhoto.show_photo(cur_oid);
		};

		/**
		* Show biggest photo
		*/
		$.prettyPhoto.show_photo = function(oid){

			$("#bad_pass").hide();
			var oid = Number(oid);
			indx = jQuery.inArray(oid, oids);

			$.prettyPhoto.current_photo_position(indx + 1, oids.length);

			var photo_huge = $("#pp_full_res_img");

			if (gender == 'F'){
				$("#thumb_" + oid).attr('class', 'selected_f');
			} else {
				$("#thumb_" + oid).attr('class', 'selected_m');
			}

			if (oid != photo_current){
				$("#thumb_" + photo_current).attr('class', 'thumb');
			}
			photo_current = oid;

			if (url[indx] == 'none'){
				photo_huge.css('display', 'none');
				$("#pp_title").html("<strong>" + descr[indx] + "</strong>");
				$(".pp_orig").css('display', 'none');
				$("#hidden_about_passwd").show();
				cur_oid = oid;
				return;
			} else {
				$("#hidden_about_passwd").hide();
				if (photo_huge.css('display') == 'none'){
					photo_huge.css('display', 'inline');
				}
			}

			photo_huge.alt = descr[indx];

			if (descr[indx].length == 0){
				$("#pp_title").html("<strong>&nbsp;</strong>");
			} else {
				$("#pp_title").html("<strong>" + descr[indx] + "</strong>");
			}

			$(".pp_orig").html(orig_size[indx]);
			var or_link = "/ps1/get_image.php?oid="+ oid +"&photo_type=orig";
			$(".pp_orig").attr('href', or_link);

			if (orig_size[indx] == 'none'){
				$(".pp_orig").css('display', 'none');
			} else {
				$(".pp_orig").css('display', 'inline');
			}

			photo_huge.src = '/pics/0.gif';
		 
			photo_loaded = new Image();
			photo_loaded.onload = function(){
				photo_huge.attr('src', '/pics/0.gif');
				photo_huge.attr('width', width[indx]);
				photo_huge.attr('height', height[indx]);
			}
			photo_loaded.src = photo_huge.src;

			photo_loaded = new Image();
			photo_loaded.onload = function(){
				photo_huge.attr('src', url[indx]);
				cur_oid = oid;
			}
			photo_loaded.src = url[indx];
			return false;
		};

		/*
		*  Write photo position
		*/
		$.prettyPhoto.current_photo_position = function(position, total){
			$(".currentTextHolder").html(position + '/' + total);
		};

		return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once

	};
})(jQuery);

function display_metro(city){
  metros = new Array();
  var city_obj_arr = city.split('_');
  var city_id = city_obj_arr[city_obj_arr.length-1];
  var show_metro = false;
  for (var i=0; i<cities_with_metro.length; i++) {
    if (city_id == cities_with_metro[i]) {
      show_metro = true;
      break;
    }
  }

  if (show_metro){
    if ($("#metro_tr").length){
      $("#testme").html("start");
      $.getJSON("/city_select.php",{form_action: 'METRO_LIST', city_id: city_id, ajax: 'true'}, function(j){
        var options = '';
        for (var i = 0; i < j.length; i++) {
          if (i == 0){
            options += '<option value="' + j[i].optionValue + '" selected="selected">' + j[i].optionDisplay + '</option>';
          } else {
            options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
          }
        }
        $("select#metro_name").html(options);
      });
    }
    $("#metro_table").css("display", "block");
    if ($.browser.msie && $.browser.version < 8) {
      $("#metro_tr").css("display", "inline");
    } else {
      $("#metro_tr").css("display", "table-row");
    }
  } else {
    $("#metro_table").css("display", "none");
    $("#metro_tr").css("display", "none");
  }
}

$(function(){

  // выбор страны и подгрузка регионов

  $("select#ctl_country").change(function(){
    $("select#ctl_region").empty();
    $("select#ctl_city").empty();
    $.getJSON("/city_select.php",{form_action: 'REGION_LIST', country_id: $(this).val(), ajax: 'true'}, function(j){
      var options = '';
      for (var i = 0; i < j.length; i++) {
        if (i == 0){
          options += '<option value="' + j[i].optionValue + '" selected="selected">' + j[i].optionDisplay + '</option>';
        } else {
          options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
        }
      }
      $("select#ctl_region").html(options);
      $("#change_city_ok").removeAttr("disabled");
    })
  });

  // выбор региона и подгрузка городов

  $("select#ctl_region").change(function(){

    $("select#ctl_city").empty();

    if ( $("select#ctl_region").val() == -1 ){  // ничего не грузить если выбран любой регион
      return;
    }

    $.getJSON("/city_select.php",{form_action: 'CITY_LIST', country_id: $("#ctl_country").val(), region_id: $(this).val(), ajax: 'true'}, function(j){
      var options = '';
      for (var i = 0; i < j.length; i++) {
        if (i == 0){
          options += '<option value="' + j[i].optionValue + '" selected="selected">' + j[i].optionDisplay + '</option>';
        } else {
          options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
        }
      }
      $("select#ctl_city").html(options);
      $("select#ctl_city option:first").selected = true;
    })
  });


  $("select#city_name").change(function(){
    
    var i = $("select#city_name").val();
    if (i == "1_1_1"){

      $("#overlay").show();
      $("#change_city").show();

      var divPopup = document.getElementById("overlay");

      if (navigator.appName == "Microsoft Internet Explorer"){
        divPopup.style.zIndex = divPopup.style.zIndex+1;

        var iFrame = document.createElement("IFRAME");
        iFrame.setAttribute("src", "");

        iFrame.style.position = "absolute";
        iFrame.style.left = divPopup.offsetLeft + 'px';
        iFrame.style.top = divPopup.offsetTop + 'px';
        iFrame.style.width = divPopup.offsetWidth + 'px';
        iFrame.style.height = divPopup.offsetHeight + 'px';
        iFrame.style.opacity = 0;
        iFrame.style.filter = "alpha(opacity='30')";

        document.body.appendChild(iFrame);

        g_PopupIFrame = iFrame;
      }

      var n = $("select#ctl_country option:first").val();

      if (n == -2){
        $.getJSON("/city_select.php",{form_action: 'COUNTRY_LIST', ajax: 'true'}, function(j){
          var options = '';
          for (var i = 0; i < j.length; i++) {
            options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
          }
          $("select#ctl_country").html(options);
          $("select#ctl_country option:first").selected = true;
        })
      }
    } else {
      display_metro(i);
    }

  });

  $("#change_city_ok").click(function () {
    cmd_select_city();
    return false;
  });

  $("select#ctl_city").dblclick(function () {
    cmd_select_city();
    return false;
  });

  function cmd_select_city(){
    var vvalue  = "";
    var vtext   = "";

    //alert($("select#ctl_region").val());

    if ( $("select#ctl_region").val() == -1 || $("select#ctl_region").val() == null){
      vvalue  = $("select#ctl_country").val() + "_0_0";
      vtext   = $("select#ctl_country option:selected").text() + ", Любой регион";
    } else {
      vvalue  = $("select#ctl_country").val() + "_" + $("select#ctl_region").val() + "_" + $("select#ctl_city").val();
      if ($("select#ctl_city").val() == 0 || $("select#ctl_city").val() == null){
        vtext   = $("select#ctl_country option:selected").text() + ", " + $("select#ctl_region option:selected").text();
      } else {
        vtext   = $("select#ctl_country option:selected").text() + ", " + $("select#ctl_city option:selected").text();
      }

    }

    addCity('fSearch', vvalue, vtext);

    $("#change_city").hide();
    $("#overlay").hide();

    if (navigator.appName == "Microsoft Internet Explorer"){
      document.body.removeChild(g_PopupIFrame);
      g_PopupIFrame=null;
    }

  }

  $("#loading").bind("ajaxSend", function(){
    $(this).show();
  }).bind("ajaxComplete", function(){
    $(this).hide();
  });

});


function addCity(vformname,vvalue,vtext){
  if (document.getElementById("city_name")){
    fcity = document.getElementById("city_name");
  }
  if (fcity.length){
    flength=fcity.length;
    fcurrent=flength-1;
  }
  if (fcity[fcurrent]){
    fcity[fcurrent].selected=true;
  }
  if (fcity.options[fcurrent]){
    fcity.options[fcurrent].text=vtext;
    fcity.options[fcurrent].value=vvalue;
    if (fcity.options[fcurrent].label){
      fcity.options[fcurrent].label=vtext;
    }
  }
  var oOption = document.createElement("option");
  oOption.appendChild(document.createTextNode("Выбрать другой город..."));
  oOption.setAttribute("value", "1_1_1");
  fcity.appendChild(oOption);
}

// WapVersion

function getCookie2(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else
    begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
        end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
}

function wapVersion(a){

	if(/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))){
		if (getCookie2('nowap') != 1){
			document.getElementById("wapVersion").style.display="block";
		}
	}
}


