var modal_container = false;
var Timer = null;
var stoptimer = null;
var closetimer = 0;
var timeout = 1000;

$(function() {
	 $('div,a,input').tooltip({
		 track: true,
		 delay: 0,
		 showURL: false,
		 fade: 200
	 });
});

$(document).ready(function($){
	$(".anim_butt").mouseover(function(){
		var arr = $(this).attr('src').split(".");		
		var src_ov = arr[0]+'_ov.'+arr[1];
		
		$(this).attr('src',src_ov);
	}).mouseout(function(){
		var arr = $(this).attr('src').split(".");		
		var src = arr[0].substring(0,arr[0].length-3)+'.'+arr[1];
		
		$(this).attr('src',src);
	});
	
	$('div.toggle_block').click(function() {	
		var tog_ob = $(this).find('div.toggle');
		if (tog_ob.length > 0){
			tog_ob.toggleClass('im_u');
			tog_ob.toggleClass('im_d');

		}					
	});	
	
	function rephone(){
		
		var reg = $('#callback_form input[name=region_id]').val();
		var fio = $('#callback_form input[name=fio]').val();
		var phone = $('#callback_form input[name=phone]').val();
		var subject = $('#callback_form textarea[name=subject]').val();
		if (fio ==''){
			$('div#callback_form div.errr').html('Введите Имя');
			$('div#callback_form div.errr').show();
			return false;
		}
		if ( phone==''){
			$('div#callback_form div.errr').html('Введите номер телефона');
			$('div#callback_form div.errr').show();
			return false;
		}
		$.getJSON('/requests/req_rephone.php',
					{id_region:reg, name:fio,phone:phone,subject:subject},
					function(data) {
						if (data.msg_err.length > 0){
							$('div#callback_form div.errr').html(data.msg_err);
							$('div#callback_form div.errr').show();
							return false;
						}
						if (data.success_msg.length > 0){						
							$('div#callback_form div.callb_frm').hide();
							$('div#callback_form div.callb_succ').html(data.success_msg);
							$('div#callback_form div.callb_succ').show();
						}
						return false;
					});	
	}


	
					function selectItem(li) {
						$("#search-but").submit();
					}
					$("#keyw").autocomplete("/requests/search_autocomplete.php", {
						delay : 5,
						minChars : 3,
						matchSubset : 1,
						autoFill : false,
						matchContains : 1,
						selectFirst : false,
						cacheLength : 10,
						onItemSelect : selectItem,
						max : 20,
						scroll : false,
						scrollHeight : 200
					});

					/* pdr */
					if ($('#overall-total').length > 0) {
						changeOverallTotal();
					}

					textboxes = $("input:text");

					if ($.browser.mozilla) {
						$(textboxes).keypress(checkForEnter);
					} else {
						$(textboxes).keydown(checkForEnter);
					}
					
					
					function checkForEnter(event) {
						if (event.keyCode == 13) {
							currentTextboxNumber = textboxes.index(this);
							if ($(textboxes[currentTextboxNumber]).attr('class') == 'noenter') {
								return false;
							}
							
							if ($(textboxes[currentTextboxNumber]).attr('class') != 'count') {
								return;
							}
							while (true) {
								currentTextboxNumber++;
								if (textboxes[currentTextboxNumber] != null) {
									nextTextbox = textboxes[currentTextboxNumber];
									if ($(nextTextbox).attr('class') == 'count'
											&& $(nextTextbox).is(':enabled')) {
										nextTextbox.select();
										break;
									}
								} else {
									break;
								}
							}
							event.preventDefault();
							return false;
						}
					}

					/* фильтр фото */
					$('.photo_filter').change(function() {
						if ($(this).is(':checked')) {
							document.location.replace('?p=1');
						} else {
							document.location.replace('?p=0');
						}
					});

					$('#left.sf-menu div.arrow').click(function() {	
						if ($(this).hasClass('arr_a'))
							return;
						var el = $(this).parent();
						var level = el.attr('level');						
						get_menu_list(level,el);						
					});
});



function get_menu_list(level,elem) {

	var id = elem.attr('id');
	id = id.substring(5, id.length);
	
	if (!id)
		return;

	var obj = elem;
	var child_menu = obj.find("div.menu_cont");
	var arrow = obj.find('div.arrow:first');
	var all_arrow = child_menu.find('div.arrow');
	if (child_menu.length == 0) {
		$.ajax( {
			type : "GET",
			url : "/requests/get_menu_list.php",
			data : {
				menu_id : id,
				level: level
			},
			beforeSend : function() {
				arrow.next().addClass('ac_loading');
			},
			success : function(msg) {
				
				obj.append("" + msg);
				obj.find('div.menu_cont div.arrow').click(function() {					
					var el = $(this).parent();	
					var level = el.attr('level');
					if (!$(this).hasClass('arr_a'))
						get_menu_list(level,el);					
				});
				
				arrow.next().removeClass('ac_loading');
				arrow.removeClass('arr_r');
				arrow.addClass('arr_d');
			}
		});
	} else {
		
		var vis = child_menu.css('display');
		
		if(vis=='none'){
			arrow.removeClass('arr_r');
			arrow.addClass('arr_d');
			child_menu.show();
		}else{
			arrow.removeClass('arr_d');
			arrow.addClass('arr_r');
			child_menu.hide();
		}
		
	}
}

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return (setStr);
}

function getElement(id) {
	try {
		return document.getElementById(id);
	} catch (e) {
		alert("Error getElement:" + e.message);
	}
}

function show_modal(message, container) {
	try {
		var modal = getElement("modal");
		if (modal) {
			modal.style.height = (document.body.offsetHeight) + 'px';
			modal.style.display = 'block';
		}
		if ('' + container == 'undefined') {
			container = 'stories';
		}

		var stories = getElement(container);
		if (stories) {
			stories.style.display = 'block';
		}

		if ('' + message != 'undefined') {

			modal_container = container;

			var message = getElement(message);
			if (message) {
				message.style.zIndex = 500;
				message.style.display = 'block';
			}
		}
	} catch (e) {
		alert('Error in show_modal:' + e.message);
	}
}
function hide_modal(message, container) {
	try {
		var modal = getElement("modal");
		if (modal) {
			modal.style.display = 'none';
		}

		var loading = getElement('loading');
		if (loading) {
			loading.style.display = 'none';
		}

		if (Timer != null) {
			clearTimeout(Timer);
			Timer = null;
		}

		if ('' + container == 'undefined') {
			container = 'stories';
		}

		var stories = getElement(container);

		if (stories) {
			stories.style.display = 'none';
		}

		if ('' + message != 'undefined') {
			var message = getElement(message);
			if (message) {
				message.style.display = 'none';
			}
		}

		if (modal_container)
			modal_container = false;

	} catch (e) {
		alert('Error in hide_modal:' + e.message);
	}
}
function small_auth_close() {
	try {
		hide_modal('small_auth', 'small_auth_container');
		return false;
	} catch (e) {
		alert('Error in small_auth_close:' + e.message);
	}
}
function small_auth() {
	try {
		show_modal('small_auth', 'small_auth_container');
		scroll(0, 0);
		if (navigator.appVersion.indexOf('MSIE 6.0') != -1) {
			document.body.scrollTop = 10;
		}
		return false;
	} catch (e) {
		alert('Error in small_auth:' + e.message);
	}
}

function autorize() {
	reg = getCookie("registered");
	if (reg !== "1") {
		small_auth();

		return false;
	}
	return true;

}

function show(url, wi, he, ran_win) {
	myWindow = window
			.open(
					url,
					ran_win,
					"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,height="
							+ he + ",width=" + wi);
	return false;
}

function show2(url, wi, he, ran_win) {
	myWindow = window
			.open(
					url,
					ran_win,
					"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height="
							+ he + ",width=" + wi);
}

function HideContent(d) {
	document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
	document.getElementById(d).style.display = "block";
}
function ReverseDisplay(d) {
	var obj = $("#"+d);
	obj.toggle();
/*
	if (document.getElementById(d).style.display == "none") {
		document.getElementById(d).style.display = "block";
	} else {
		document.getElementById(d).style.display = "none";
	}
*/
}


function displayImage(targetURL, caption, width, height, cat) {
	if (width == null || width == "")
		width = 600;
	if (height == null || height == "")
		height = 430;
	if (targetURL.indexOf(".jpg") != -1 || targetURL.indexOf(".gif") != -1
			|| targetURL.indexOf(".jpeg") != -1
			|| targetURL.indexOf(".png") != -1)
		window
				.open(
						"/displayImage.php?image=" + targetURL + "&title="
								+ caption + "&cat=" + cat,
						"",
						"titlebar=no,toolbar=no,location=no,directories=no,menubar=no,resizable=yes,scrollbars=yes,width="
								+ width + ",height=" + height + ",status=no");
	else
		alert('Данный файл не является изображением');
	return false;
}

function MM_preloadImages() { // v3.0
	var d = document;
	if (d.images) {
		if (!d.MM_p)
			d.MM_p = new Array();
		var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
		for (i = 0; i < a.length; i++)
			if (a[i].indexOf("#") != 0) {
				d.MM_p[j] = new Image;
				d.MM_p[j++].src = a[i];
			}
	}
}

function MM_swapImgRestore() { // v3.0
	var i, x, a = document.MM_sr;
	for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++)
		x.src = x.oSrc;
}

function MM_findObj(n, d) { // v4.01
	var p, i, x;
	if (!d)
		d = document;
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
	if (!(x = d[n]) && d.all)
		x = d.all[n];
	for (i = 0; !x && i < d.forms.length; i++)
		x = d.forms[i][n];
	for (i = 0; !x && d.layers && i < d.layers.length; i++)
		x = MM_findObj(n, d.layers[i].document);
	if (!x && d.getElementById)
		x = d.getElementById(n);
	return x;
}

function MM_swapImage() { // v3.0
	var i, j = 0, x, a = MM_swapImage.arguments;
	document.MM_sr = new Array;
	for (i = 0; i < (a.length - 2); i += 3)
		if ((x = MM_findObj(a[i])) != null) {
			document.MM_sr[j++] = x;
			if (!x.oSrc)
				x.oSrc = x.src;
			x.src = a[i + 2];
		}
}

// / Установка куки
function SetCookie(name, value, expires, path, domain, secure) {
	szCookie = name + "=" + escape(value)
			+ ((expires) ? "; expires=" + expires.toGMTString() : "")
			+ ((path) ? "; path=" + path : "")
			+ ((domain) ? "; domain=" + domain : "")
			+ ((secure) ? "; secure" : "");
	document.cookie = szCookie;
}

function change_city(mycity_id) {
	SetCookie("my_city", mycity_id, "", "/", ".ambar.ua", "");
}

$(document).ready(function() {

	$(".inc").click(function() {
		var obj = $(this);
		var fav = obj.attr("fav");
		var id = obj.attr("href");
		var price = obj.attr("rel");
		var divider = parseFloat(obj.attr("divider"));
		if (fav == 1){
			changeProductAmount(id, divider, divider,1);
		}else
			changeProductAmount(id, divider, divider,0);
		if (price) {
			changeProductTotal(id, price);
		}

		return false;
	});

	$(".dec").click(function() {
		var obj = $(this);
		var fav = obj.attr("fav");
		var id = obj.attr("href");
		var price = obj.attr("rel");
		var divider = parseFloat(obj.attr("divider"));
		if (fav == 1){
			changeProductAmount(id, -1 * divider, divider,1);
		}else
			changeProductAmount(id, -1 * divider, divider,0);
		
		if (price) {
			changeProductTotal(id, price);
		}
		return false;
	});

	$(".count").change(function() {
		var id = $(this).attr("id");
		var fav = obj.attr("fav");
		id = id.substring(3, id.length);
		var obj = $("#dec" + id);
		var price = obj.attr("rel");
		var divider = parseFloat($(this).attr("divider"));
		if (fav == 1){
			changeProductAmount("#cnt" + id, 0, divider,1);
		}else
			changeProductAmount("#cnt" + id, 0, divider,0);
		
		if (price) {
			changeProductTotal("#cnt" + id, price);
		}
	});		
	$("#all_regions_block div.region_select").click(function() {
		var cur_reg_id = $('#my_region_id').val();
		var reg_id = $(this).find("input").val();	
		if(cur_reg_id !=reg_id){
			$('#all_regions_block').hide();	
			change_city(reg_id);	
			
			window.location.href = '/';
			
		}else
			$('#all_regions_block').hide();
	});
	

	var keyw_text = 'Поиск по товарам';

	$("#keyw").focus(function() {
		if (keyw_text == this.value) {
			this.value = '';
		}
	}).blur(function() {
		if (!$.trim(this.value)) {
			this.value = keyw_text;
		}
	}).blur();

	$(".search_but").click(function() {
		$("#search-but").submit();
		return false;
	});

	var cnt = $('#basket-cnt').innerHTML;
	var bas_am = $('#basket-amount').innerHTML;
/*
	var flying_basket = document.getElementById('flying_basket');
	if (parseInt(cnt) > 0) {

		$("#basket-fly-cnt").text(cnt);
		$("#basket-fly-amount").text(bas_am);
		if (flying_basket)
			flying_basket.style.display = 'block';
	} else {
		if (flying_basket)
			if (flying_basket.style.display == 'block') {

				flying_basket.style.display = 'none';
			}
	}
*/
$(".basket_tovar").each(function() {	
	
		if ($(this).attr("id").substring(0,3) != 'pdr'){
			
			var obj = $(this).find('.product_count input');
			var divider = parseFloat(obj.attr("divider"));
			var count = parseFloat(obj.val());
			if (count < divider){
				obj.val(divider);
			}else if (count > divider){
				obj.val(count-count%divider);
			}
			var id = obj.attr("id");
			id = id.substring(3, id.length);
			changeProductTotal("#cnt"+id, $(this).find('.product_minus a').attr("rel"));
		}	
	});
	//$('#modal').removeClass('loading');

});
var changeProductPackPrice = function(id,fav) {
	var amount = $(id).val();
	id = id.substring(4, id.length);
	var obj = $("#price" + id);
	var price = obj.attr("rel");

	var total_pack = (price * amount).toFixed(2) + "";
	var arr = total_pack.split(".");
	if (fav == 0){
		$("#pack" + id).html(
				"<span>"
						+ arr[0]
						+ "</span>,"
						+ (arr.length > 1 ? arr[1] + (arr[1].length > 1 ? "" : "0")
								: "00") + " <span class='product_grn'>грн.</span>");
	}else{
		$("#fpack" + id).html(
				"<span style='font-size:15px;'>"
						+ arr[0]
						+ "</span>,"
						+ (arr.length > 1 ? arr[1] + (arr[1].length > 1 ? "" : "0")
								: "00") + " <span class='product_grn'>грн.</span>");
	}

}

var changeProductAmount = function(id, amount, divider,fav) {
	var obj = $(id);
	var val = (parseFloat(obj.val()) * 1000 + parseFloat(amount) * 1000) / 1000;

	val = ((val * 1000) - (val * 1000) % (divider * 1000)) / 1000;

	if (isNaN(val) || val <= 0) {
		val = divider;
	}

	obj.val(Math.round(val * 100) / 100);
	changeProductPackPrice(id,fav);
}

var changeProductTotal = function(id, price) {
	var amount = $(id).val();
	var total = Math.round(price * amount * 100) / 100 + "";
	var arr = total.split(".");
	
	id = id.substring(4, id.length);

	$("#total" + id).html(
			"<span>"
			+ arr[0]
			+ "</span>,"
			+ (arr.length > 1 ? arr[1] + (arr[1].length > 1 ? "" : "0"): "00") + " <span class='product_grn'>грн.</span>");

	$.getJSON(	'/recalcTotal.php',
					{
						id : id,
						amount : amount
					},
					function(data) {
						//var flying_basket = document.getElementById('flying_basket');
						$("#basket-cnt").text(data.cnt);
						$("#basket-amount").text(data.amount);
						$("#bonus_amount").text(data.bonuses);
						
						if(data.frd == "1"){
							$("#free_del_pict").show();							
						}else{
							$("#free_del_pict").hide();
						}
					/*	$("#basket-fly-cnt").text(data.cnt);
						$("#basket-fly-amount").text(data.amount);

						if (flying_basket) {
							if (parseInt(data.cnt) > 0) {

								document.getElementById('flying_basket').style.display = 'block';
							} else {
								document.getElementById('flying_basket').style.display = 'none';
							}
						}
						*/
						for ( var i = 1; i < 4; i++) {
							$("#apple" + i).attr(
									"src",
									"/res/apl" + i + "_"
											+ (i == data.level ? 'col' : 'gr')
											+ ".jpg");
						}
					});

	changeOverallTotal();
}

var changeOverallTotal = function() {
	var total = 0;
	var temp = '';
	var len = 0;

	$(".prod-total").each(function() {
		if (!$(this).parent().find('input.count').is(':disabled')) {
			temp = $(this).text();
			len = temp.length;
			temp = temp.substring(0, len - 5);
			temp = temp.replace(",", ".").replace(' ', '');
			total += parseFloat(temp);
		}
	});

	if ($("#overall-total").length > 0) {

		var pdr1 = parseInt($('#pdr1 .prod-total span:first').text());
		var pdr2 = parseInt($('#pdr2 .prod-total span:first').text());
		var pdr3 = parseInt($('#pdr3 .prod-total span:first').text());

		totalfuck = total;

		if (totalfuck < min_order_limit) {
			document.getElementById('fuck2_message').innerHTML = 'Минимальная сумма заказа '
					+ min_order_limit
					+ ' грн. (+ '
					+ delivery1
					+ ' грн за доставку)';

			$('#fuck1').hide();
			$('#fuck2_message').show();
			$('#fuck2').show();
		} else {
			$('#fuck1').show();
			$('#fuck2_message').hide();
			$('#fuck2').hide();
		}
		
		if($('#pdr1').length>0){
			if (totalfuck < limit1) {
				$('#pdr1').show();
				$('#pdr2').hide();
				$('#pdr3').hide();
				temp = $('#pdr1 .prod-total').text();
				len = temp.length;
				temp = temp.substring(0, len - 5);
				temp = temp.replace(",", ".").replace(' ', '');
				total += parseFloat(temp);
			} else if (totalfuck > limit2) {
				$('#pdr1').hide();
				$('#pdr2').hide();
				$('#pdr3').show();
				temp = $('#pdr3 .prod-total').text();
				len = temp.length;
				temp = temp.substring(0, len - 5);
				temp = temp.replace(",", ".").replace(' ', '');
				total += parseFloat(temp);
			} else {
				$('#pdr1').hide();
				$('#pdr2').show();
				$('#pdr3').hide();
				temp = $('#pdr2 .prod-total').text();
	
				len = temp.length;
				temp = temp.substring(0, len - 5);
				temp = temp.replace(",", ".").replace(' ', '');
				total += parseFloat(temp);
			}
		}
		var arr_temp = temp.split(".");
		delivery = (arr_temp[0] + "," + (arr_temp.length > 1 ? arr_temp[1]
				+ (arr_temp[1].length > 1 ? "" : "0") : "00"));
		$("#basket-fly-delivery").text(delivery);
	}

	total = Math.round(total * 100) / 100;
	/*
	 * if (total < maxWeekAmount) {
	 * document.getElementById('basket_nomination_text').innerHTML = 'До участия
	 * в номинации "Заказ недели" не хватает <span id="nomination_amount"
	 * style="font-weight:bold">'+(maxWeekAmount - total).toFixed(2)+'</span>
	 * грн.'; } else {
	 * document.getElementById('basket_nomination_text').innerHTML = 'При такой
	 * сумме заказа Вы становитесь участником соревнования'; }
	 */
	total += "";
	//alert(total);
	var arr = total.split(".");
	if (arr.length > 1) {
		arr[1] = arr[1].substring(0, 2);
	}
	//alert(arr[0]);
	$("#overall-total").html(
			"<span>"
					+ arr[0]
					+ "</span>,"
					+ (arr.length > 1 ? arr[1] + (arr[1].length > 1 ? "" : "0")
							: "00") + " <span class='product_grn'>грн.</span>");
}
function rephone(){
	
	var reg = $('#callback_form input[name=region_id]').val();
	var fio = $('#callback_form input[name=fio]').val();
	var phone = $('#callback_form input[name=phone]').val();
	var subject = $('#callback_form textarea[name=subject]').val();
	if (fio ==''){
		$('div#callback_form div.errr').html('Введите Имя');
	}
	if ( phone==''){
		$('div#callback_form div.errr').html('Введите номер телефона');
	}
	$.getJSON('/requests/req_rephone.php',
				{id_region:reg, name:fio,phone:phone,subject:subject},
				function(data) {
					if (data.msg_err.length > 0){
						$('div#callback_form div.errr').html(data.msg_err);
						$('div#callback_form div.errr').show();
						return false;
					}
					if (data.success_msg.length > 0){						
						$('div#callback_form div.callb_frm').hide();
						$('div#callback_form div.callb_succ').html(data.success_msg);
						$('div#callback_form div.callb_succ').show();
					}
					return false;
				});	
}

function getBrouse() {
	var nVer = navigator.appVersion;
	var nAgt = navigator.userAgent;
	var browserName = navigator.appName;
	var fullVersion = '' + parseFloat(navigator.appVersion);
	var majorVersion = parseInt(navigator.appVersion, 10);
	var nameOffset, verOffset, ix;

	// In MSIE, the true version is after "MSIE" in userAgent
	if ((verOffset = nAgt.indexOf("MSIE")) != -1) {
		browserName = "Microsoft Internet Explorer";
		fullVersion = nAgt.substring(verOffset + 5);
	}
	// In Opera, the true version is after "Opera"
	else if ((verOffset = nAgt.indexOf("Opera")) != -1) {
		browserName = "Opera";
		fullVersion = nAgt.substring(verOffset + 6);
	}
	// In Chrome, the true version is after "Chrome"
	else if ((verOffset = nAgt.indexOf("Chrome")) != -1) {
		browserName = "Chrome";
		fullVersion = nAgt.substring(verOffset + 7);
	}
	// In Safari, the true version is after "Safari"
	else if ((verOffset = nAgt.indexOf("Safari")) != -1) {
		browserName = "Safari";
		fullVersion = nAgt.substring(verOffset + 7);
	}
	// In Firefox, the true version is after "Firefox" 
	else if ((verOffset = nAgt.indexOf("Firefox")) != -1) {
		browserName = "Firefox";
		fullVersion = nAgt.substring(verOffset + 8);
	}
	// In most other browsers, "name/version" is at the end of userAgent 
	else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt
			.lastIndexOf('/'))) {
		browserName = nAgt.substring(nameOffset, verOffset);
		fullVersion = nAgt.substring(verOffset + 1);
		if (browserName.toLowerCase() == browserName.toUpperCase()) {
			browserName = navigator.appName;
		}
	}
	// trim the fullVersion string at semicolon/space if present
	if ((ix = fullVersion.indexOf(";")) != -1)
		fullVersion = fullVersion.substring(0, ix);
	if ((ix = fullVersion.indexOf(" ")) != -1)
		fullVersion = fullVersion.substring(0, ix);

	majorVersion = parseInt('' + fullVersion, 10);
	if (isNaN(majorVersion)) {
		fullVersion = '' + parseFloat(navigator.appVersion);
		majorVersion = parseInt(navigator.appVersion, 10);
	}
	if(browserName=='Microsoft Internet Explorer'){
		alert('Уважаемый посетитель!\nПоскольку Вы используете браузер Internet Explorer - большинство функций сайта не будет Вам доступно.\nИспользуйте браузер Opera,Google Chrome или FireFox для комфортной и полнофункциональной работы с сайтом.\nИзвините за неудобства');
	}
	//document.write('Browser name = '+browserName+'<br>');
	//document.write('Full version = '+fullVersion+'<br>');
	//document.write('Major version = '+majorVersion+'<br>');
	//document.write('navigator.appName = '+navigator.appName+'<br>');
	//document.write('navigator.userAgent = '+navigator.userAgent+'<br>');
	return majorVersion;
}
getBrouse();

