function bookmarksite(title, url)
{ 
	if (document.all) 
	window.external.AddFavorite(url, title); 
	else if (window.sidebar) 
	window.sidebar.addPanel(title, url, "")
}

$(document).ready(function(){
	
	$('#fav_png').click(function(){
				
			if (document.all) 
				window.external.AddFavorite(window.location, document.title); 
			else if (window.sidebar) 
				window.sidebar.addPanel(document.title, window.location, "")
				
		});
						   
	$(".slide_div a").click(function(){
	    var main_div = $(this).parents(".block_1");
	    $(".slide_panel",main_div).slideToggle("slow");
			  
			  
		//$("#slide_panel").slideToggle("slow");
		$(this).toggleClass("minus_icon"); 
		return false;
	});
	
	
	
	
		/* CAROUSEL */
		
		var car = $(".default").length;
		if(car > 0)
		{
			$(".default .jCarouselLite").jCarouselLite({
				auto: 2500,
				speed: 2500,
				visible:5,
				btnNext: ".default .carnext",
				btnPrev: ".default .carprev"
			});   
		}
		
		/* ICONS */
		$("#iconbar li").hover(
		function(){
			
			$(this).find("span").attr({
				"style": 'display:inline'
			});
			$(this).find("span").animate({opacity: 1, top: "-50"}, {queue:false, duration:400});
		}, 
		function(){
			
			$(this).find("span").animate({opacity: 0, top: "-40"}, {queue:false, duration:400}, "linear",
				function(){
					$(this).find("span").attr({"style": 'display:none'});			
				}
			);
		});
		
		
		$(".imnblock").hover(
		function(){
			$(this).removeClass('inact');
			$(this).addClass('act');
		}, 
		function(){
			$(this).removeClass('act');
			$(this).addClass('inact');
		});
		
		if($('.portfolio_menu').length>0)
		{
		initMenu();
		}
		
		DD_roundies.addRule('.rounds10', '10px');
		if($.browser.msie && $.browser.version=="6.0")
		{
			DD_belatedPNG.fix('.footer,.topmenu_pos,.title_box,.bgline,img');
		}
	
	if($('#vid').val())
	{
		viewPlayer_Jw('playerblock',$('#thumb').val(),$('#vid').val());
	}

});

var  viewPlayer_Jw = function(place,thumb,video)
{
	jwplayer(place).setup({
		flashplayer: "/upload/player.swf",
		file: video,
		image:thumb,
		height: 680,
		width: 700,
		skin:'/upload/glow.zip',
		stretching:'none'
	});
}


function initMenu() {
$('.menusub').hide();

	$('.menuparent').click(function()
	{
		$('.menusub').removeClass('db');
		_art = '#sub_'+this.id;
		
		if($(_art).hasClass('inview'))
		{
			$(_art).removeClass('inview');
			$(_art).slideUp(350);
		}
		else
		{
			$('.menusub').removeClass('inview');
			$('.menusub').hide();

			$(_art).addClass('inview');
			$(_art).slideDown(350);
			
		}

		return false;
	});
		$act = $('.act');
		
		if($act.length > 0)
		{	
			_parent = $act.parent().parent().attr('id');
			_parent = _parent.replace('sub_','#');
			$(_parent).trigger('click');
		}
		
}

/*
function slideSwitch() {
    var $active = $('#slideshow IMG.active');
 
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
 
    // use this to pull the images in the order they appear in the markup
    	var $next =  $active.next().length ? $active.next() : $('#slideshow IMG:last');
 
    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );
 
 
    $active.addClass('last-active');
 
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}*/



/*
function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});
*/
    $(function() { 
		
        $(".menuSlide").lavaLamp({ fx: "backout", speed: 700 })
	    $(".more a").toggle(function () {
			  $(".popup",main_div).hide();
			  var main_div = $(this).parents(".bann");
			  $(".popup",main_div).slideDown("slow");
			  return ;
	    },function(){
	    	var main_div = $(this).parents(".bann");
			$(".popup",main_div).slideUp("slow");
			 return ;
		});

        var thumb_left=0;
        var speed = 500;
        var image_qty = $(".thumb_slider .thumb_img").size();
        $(".down a").bind("click",function(){
        	if( thumb_left <= (1-image_qty)*1003) return false;
			thumb_left -= 1003;
			$(".thumb_slider").animate({left: thumb_left+"px"},speed)
    	});
        $(".up a").bind("click",function(){
        	if(thumb_left >= 0) return false;
			thumb_left += 1003;
			$(".thumb_slider").animate({left: thumb_left+"px"},speed)
		});
        
    });
	
   	$(window).load(function () {
  	     $(".fadein").fadeOut("slow");
  	     $(".fadein").fadeIn("slow");
  	});
	
	/*
	$(function() {
			   
			$(".scrollable").each( function (i,e) { $(e).scrollable({clickable: false}).navigator(); }  )

				
				var Ximg = new Image();
                    Ximg.src = "/images/no.gif";
					Ximg.id = "nogif";
					Ximg.width = "1";
					Ximg.height= "1";
					Ximg.className = "pagingImage";
									
				$(Ximg).insertBefore(".block_1");	   
			$(".pagingImage").each( function(i,e)
				 {
					var img = new Image();
					img.src = $(e).attr('rel');
					var _div = document.createElement("div");
					_div.id = "OV"+e.id;
					_div.className = "simple_overlay";
					_div.appendChild(img);
					
					$(e).attr('rel',"#OV"+e.id);
					_div.style.display = "none";
					document.body.appendChild(_div);
				 }
			);
			var qty = $(".pagingImage").length;
			if(qty > 0)
			$(".pagingImage[rel]").overlay({expose: '#000'}).gallery({speed: 800});
			
			$(Ximg).remove();
			$("#OVnogif").remove();
			
	});
	*/
	
	
	function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(40.178978, 44.518661), 16);
        map.setUIToDefault();
		map.setMapType(G_HYBRID_MAP);
        
        // Create our "tiny" marker icon
        var blueIcon = new GIcon(G_DEFAULT_ICON);
        blueIcon.image = "http://studio-one.am/images/studio-one.png";
		
		// Set up our GMarkerOptions object
		markerOptions = { icon:blueIcon };
 
        var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
        var lngSpan = northEast.lng() - southWest.lng();
        var latSpan = northEast.lat() - southWest.lat();
       
        var latlng = new GLatLng(40.178978, 44.518661);
        map.addOverlay(new GMarker(latlng, markerOptions));
      }
    }
	

