/*--<!module!>--*//*----------!Товар!-----------*/
/*bonus*/

#bonus>p{font-size: 26px;color: #333;}
#bonus>.content{height: 300px;border: 1px solid #D8D7D7;padding: 10px;}
#bonus .math{font-size: 90px;}
#bonus .math p{color: #B4D194;}
#bonus a{color: #767676;font-size: 16px;}
#bonus .info p{max-height: 70px;}
#bonus form .cart{height:0px;overflow:hidden;}
#bonus form .grid-spacer {height:0px;overflow:hidden;border: none;}
#bonus .product_outside_border{border: none;}
#bonus table{height: 270px;margin:0px auto;margin-top: 15px;width: 700px;overflow:hidden;position: relative;top: -300px;}
#bonus table td{text-align:center;height:270px;}
#bonus table td .info{height: 110px;font-size: 16px;text-align: left;}
#bonus table td .info .price{font-size: 22px;font-weight:700;}
#bonus table td .info .price .price-tax strike{color:#898989}
#bonus table td .info .price_two{color:#f94d11}
#bonus table td .total_price .price{font-size: 32px;font-weight:700;}
#bonus table td .total_price .economic{font-size: 16px;font-weight: 700;color: #A3A3A3;margin: 5px;}

#bonus .left_ar{float:left;background: url(/design/shopcart/images/arrow_action.png) no-repeat 0px;background-position-x: -4px;}
#bonus .right_ar{float:right;background: url(/design/shopcart/images/arrow_action.png) no-repeat 0px;background-position-x: -33px;}
#bonus .left_ar:hover{background: #F0F0F0 url(/design/shopcart/images/arrow_action.png) no-repeat 0px;background-position-x: -4px;}
#bonus .right_ar:hover{background: #F0F0F0 url(/design/shopcart/images/arrow_action.png) no-repeat 0px;background-position-x: -33px;}
#bonus .arrow {height: 300px;width: 32px;cursor:pointer;}

#bonus .slide{position: relative;background: white;height: 300px;margin-left: 35px;margin-right: 35px;opacity:0;z-index:0;}

.bonus_table .image{width: 200px;}
.bonus_table .image a{float:left;}
.bonus_table .name p{font-size: 14;font-weight: 700;color: #B4D194;}

.cart-info tbody tr.bonus_group div{height:77px;line-height:57px;}

/*bonus end*/






.pagination li {
  float: left;
  margin-left: 5px;
}
.pagination {
  float: right;
}
/*----------!Слайдер!-----------*/
#wowslider-container1 { 
	zoom: 1; 
	float:left;
	position: relative; 
	max-width:100%;	
	/*z-index:90;*/
	border:none;
	text-align:left; /* reset align=center */
}
#wowslider-container1 .ws_bulframe {
    line-height:48px;
    
}
#wowslider-container1 .ws_bulframe img,#wowslider-container1 .ws_bullets img {
    vertical-align: middle;
    width: 128px;
}
#wowslider-container1 .ws_images ul{
	position:relative;
	width: 10000%; 
	height:auto;
	left:0;
	list-style:none;
	margin:0;
	padding:0;
	border-spacing:0;
	overflow: visible;
	/*table-layout:fixed;*/
}
#wowslider-container1 .ws_images ul li{
	width:1%;
	line-height:0; /*opera*/
	float:left;
	font-size:0;
	padding:0 0 0 0 !important;
	margin:0 0 0 0 !important;
}

#wowslider-container1 .ws_images{
	position: relative;
	left:0;
	top:0;
	width:100%;
	overflow:hidden;
}
#wowslider-container1 .ws_images a{
	width:100%;
	display:block;
	color:transparent;
}
#wowslider-container1 img{
	max-width: none !important;
}
#wowslider-container1 .ws_images img{
	width:100%;
	border:none 0;
	max-width: none;
	padding:0;
}
#wowslider-container1 a{ 
	text-decoration: none; 
	outline: none; 
	border: none; 
}
#wowslider-container1 .ws-title{
	/*position: absolute;
	bottom: 10%;
	left: 7%;
	z-index: 50;
	padding:12px;
	color: #000000;
	background:#fff;
	  font-family:Impact,Charcoal,sans-serif;
	font-size: 30px;
	text-shadow: 1px 1px 1px #BBBBBB;
	line-height: 30px;
	border-radius:5px;
	-moz-border-radius:5px;
	-webkit-border-radius:5px;
	opacity:0.5;
	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);	*/
}
#wowslider-container1 .ws-title div{
	/*font-size: 14px;
	text-shadow: 1px 1px 1px #000000;*/
}#wowslider-container1 .ws_images ul{
	animation: wsBasic 4s infinite;
	-moz-animation: wsBasic 4s infinite;
	-webkit-animation: wsBasic 4s infinite;
}
@keyframes wsBasic{0%{left:-0%} 50%{left:-0%} }
@-moz-keyframes wsBasic{0%{left:-0%} 50%{left:-0%} }
@-webkit-keyframes wsBasic{0%{left:-0%} 50%{left:-0%} }




/*----------!menu!-----------*/
#catalog .mega-menu>ul{
	width:765px;
	position:absolute;
	top:49px;
	left:170px;
	height:540px;
	padding:10px;
}
#catalog>ul>.dropdown.mega-menu{
	position:inherit;
}
/*----------!callback!-----------*/
.css_intup_form{
position: absolute;
background-color: #fff;
padding: 10px;
z-index: 99999999999999999;
}
/*----------!Сторінки!-----------*/
/*Бігуча строки та, що зверху*/
var intervalID;
var kk=0;
var v;
if($('.stroka').length){
	var intervalID=window.setInterval(wind, 5000);
}else{
	clearInterval(intervalID)
}
function wind(){
	for(i=0; i<10;i++){
		$('.latest_divs>div:eq('+i+')').hide(1000);
	}
	$('.latest_divs>div:eq('+kk+')').show(1000);
	kk++;
	if(kk>9)
		kk=0;
}

$('.red_rectangle .arr').click(function(){
    if($(this).hasClass('down')){
        kk-=2;
        if(kk<0)
		    kk=9;
    }
    wind()
})

$('.grid7.alpha .brands').click(function(){
    nid = $(this).attr('brand');
    $.post(set.ws,{q:'getDetailBrandInfo',nid:nid},function(data){
		$('.detail_brand_info').html(data);
	});
});

$(".search_page input").keydown(function(event) {
    if(event.keyCode==13 && !event.cancel) 
    	search_page();		
	
});

function search_page(){
    var inp=$(".search_page input");
	$(document)[0].location.href=inp.attr('url')+(inp.val()).trim();
}
$(".search_page span").click(function(event) {	
	$(document)[0].location.href=$(this).parent().find('input').attr('url')+($(this).parent().find('input').val()).trim();	
});


//include script in php
/*
function loadScript() 
{
	var script = document.createElement("script");
	script.type = "text/javascript";
	script.src = "https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false";
    //"http://maps.googleapis.com/maps/api/js?v=3.9&sensor=true&callback=get_points";
	document.getElementsByTagName('head')[0].appendChild(script);
}
*/
if(typeof(map_canvas)!= "undefined")
	google.maps.event.addDomListener(window, 'load', initialize);
    //window.onload = loadScript;


function getBoundsZoomLevel(bounds, mapDim) {
    var WORLD_DIM = { height: 256, width: 256 };
    var ZOOM_MAX = 18;

    function latRad(lat) {
        var sin = Math.sin(lat * Math.PI / 180);
        var radX2 = Math.log((1 + sin) / (1 - sin)) / 2;
        return Math.max(Math.min(radX2, Math.PI), -Math.PI) / 2;
    }

    function zoom(mapPx, worldPx, fraction) {
        return Math.floor(Math.log(mapPx / worldPx / fraction) / Math.LN2);
    }

    var ne = bounds.getNorthEast();
    var sw = bounds.getSouthWest();

    var latFraction = (latRad(ne.lat()) - latRad(sw.lat())) / Math.PI;

    var lngDiff = ne.lng() - sw.lng();
    var lngFraction = ((lngDiff < 0) ? (lngDiff + 360) : lngDiff) / 360;

    var latZoom = zoom(mapDim.height, WORLD_DIM.height, latFraction);
    var lngZoom = zoom(mapDim.width, WORLD_DIM.width, lngFraction);

    return Math.min(latZoom, lngZoom, ZOOM_MAX);
}

var latLng = [];
function initialize() {
    var latlngbounds = new google.maps.LatLngBounds();
    if(map_canvas instanceof Array){
		for(i=0;i<map_canvas.length;i++){
			latLng[latLng.length]=[];
			latLng[i][0] = new google.maps.LatLng(map_canvas[i]['loc'].y-0, map_canvas[i]['loc'].x-0);
			latLng[i][1] = map_canvas[i]['title']+"\n"+map_canvas[i]['adr'];//+"\n"+map_canvas[i][0].str+" "+map_canvas[i][0].number;
			latLng[i][2] = map_canvas[i]['nid'];
            latLng[i][4] = map_canvas[i]['alias']?map_canvas[i]['alias']:'';
            latlngbounds.extend(latLng[i][0]);            
		}
		latLng[0][3]=map_canvas[0]['image'];
	}else{
		latLng[latLng.length]=[];
		latLng[0][0] = new google.maps.LatLng(map_canvas.lon, map_canvas.lat); 
		latLng[0][1] = map_canvas.name;
		latLng[0][2] = map_canvas.link;
		latLng[0][3] = map_canvas.image;
		latLng[0][4] = map_canvas.page_url;
        latlngbounds.extend(latLng[0][0]);		
	}
    /*
    //-----центр и зум----
    var allx=0;var ally=0; var _points=[];
    var min_x=1000; var max_x=0; var min_y=1000; var max_y=0;
    for(var k=0,len=latLng.length;k<len;k++){
        allx+=latLng[k][0].lat();
        ally+=latLng[k][0].lng()
        min_x=min_x>latLng[k][0].lat()?latLng[k][0].lat():min_x;
        max_x=max_x<latLng[k][0].lat()?latLng[k][0].lat():max_x;
        min_y=min_y>latLng[k][0].lng()?latLng[k][0].lng():min_y;
        max_y=max_y<latLng[k][0].lng()?latLng[k][0].lng():max_y;
        _points.push(latLng[k][0].lat());
    }
    var scale=(_points.max()-_points.min()).round(4);
  
    var zoom=[[30,3],[20,4],[10,5],[4,6],[1.8,7],[1.3,8],[0.5,9],[0.2,10],[0.11,11],[0.02,12],[0.01,14],[0.005,15],[0,16]];
    var _zoom=1;
    for(i=zoom.length-1; i>=0; i--){
        if(zoom[i][0]>=scale){
            _zoom=zoom[i][1];
            break;
        }
    }
    */
    var canvasWidth = document.getElementById("map-canvas").offsetWidth;
    var canvasHeight = document.getElementById("map-canvas").offsetHeight;
    var mapDim = { width: canvasWidth - canvasWidth*0.2, height: canvasHeight };
	var mapOptions = {
		//zoom: map_canvas.zoom||_zoom,
		//center: new google.maps.LatLng((max_x-min_x)/2+min_x, (max_y-min_y)/2+min_y),
		zoom:getBoundsZoomLevel(latlngbounds,mapDim),
		center:latlngbounds.getCenter(),
		mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	
	var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
	var marker = [];
	if(latLng[0][3])
	{
		var markerImage = new google.maps.MarkerImage(
    			latLng[0][3],
    			new google.maps.Size(40,40),
    			new google.maps.Point(0,0),
    			new google.maps.Point(0,40)
		);
	}
	for(i=0;i<latLng.length;i++)
	{
		if(markerImage)
		{
			marker[i] = new google.maps.Marker({
				icon: markerImage,
				position: latLng[i][0],
  				map: map,
	  			title: latLng[i][1]
			});
		}
		else
		{
			marker[i] = new google.maps.Marker({
				position: latLng[i][0],
  				map: map,
	  			title: latLng[i][1]
			});	
		}
		if(latLng.length>1 && latLng[i][4])
			createEvent(marker[i],map,i);
	}

}


function createEvent(marker,map,i)
{
	google.maps.event.addListener(marker, 'click', function() 
	{
        if(location.host=='hz')
        {
            url = location.href.match(/^http:\/\/hz\/[^\/]+/g);
            if(url instanceof Array && url.length!=0)
                location.href=url[0]+'/'+latLng[i][4];
        }
        else
        	location.href=location.origin+'/'+latLng[i][4];
  	});
}







 require_once('pg.php');