﻿$(document).ready(function() {
    $('.top').click(function(){
        if($.browser.safari){
            bodyelem = $("body")
        } else{
            if($.browser.opera){
                bodyelem = $("html")
            } else{
                bodyelem = $("html,body")
            }
        }
        bodyelem.animate({scrollTop: 0});
        return false;
    });
});

//hinter
$(function() {
$('.mainMenu').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	extraClass: "item",
	showBody: " - ",
	fade: 250
});

$('.mainMenuActive').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	extraClass: "item",
	showBody: " - ",
	fade: 250
});

$('#botlinker a').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	extraClass: "item",
	showBody: " - ",
	fade: 250
});

$('.host_but').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	extraClass: "item",
	showBody: " - ",
	fade: 250
});

$('#various').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	extraClass: "item",
	showBody: " - ",
	fade: 250
});

});

// on main

refreshFrame = function(){	
	/*document.getElementById('cframe').contentWindow.location.reload();*/
	window.location.reload();
 /*alert("fghfg");
 /*setTimeout(function(){refreshFrame()},1000);*/
}


$(document).ready(function(){
						   
						   
						   
//pri scrollinge
/*
$(window).scroll(function () { 
	if  ($(window).scrollTop() >=200)
	{
		//$("#carus").css("display", "").fadeOut("slow"); 
 		//alert($(window).scrollTop());
		//$("#archive").css("display", "none"); 
	}
});
*/						   
						
	myPortScroll = function(){	
	//scrollTo(0,400);
	   if($.browser.safari){
            bodyelem = $("body")
        } else{
            if($.browser.opera){
                bodyelem = $("html")
            } else{
                bodyelem = $("html,body")
            }
        }
        bodyelem.animate({scrollTop: 380});
	}	
	
	myContScroll = function(){	
        if($.browser.safari){
            bodyelem = $("body")
        } else{
            if($.browser.opera){
                bodyelem = $("html")
            } else{
                bodyelem = $("html,body")
            }
        }
        bodyelem.animate({scrollTop: 315});
	}	
	
	
	$("a.questLink").click(function () {
      elementClick = $(this).attr("href");
      destination = $(elementClick).offset().top;
      if($.browser.safari){
        $('body').animate( { scrollTop: destination }, 1000 );
      }else{
        $('html').animate( { scrollTop: destination }, 1000 );
      }
      return false;
    });	   
	
	$("a.qlink").click(function () {
      elementClick = $(this).attr("href");
      destination = $(elementClick).offset().top;
      if($.browser.safari){
        $('body').animate( { scrollTop: destination }, 600 );
      }else{
        $('html').animate( { scrollTop: destination }, 600 );
      }
      return false;
    });	  
	
	$(".NewsList").click(function(){
		$("#NewsPanel").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});	
	
	$(".price_1").click(function(){
		$("#PricePanel_2").slideUp("slow");
		$("#PricePanel_3").slideUp("slow");
		
		$("#PricePanel_1").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
	$(".price_2").click(function(){
		$("#PricePanel_1").slideUp("slow");
		$("#PricePanel_3").slideUp("slow");
		
		$("#PricePanel_2").slideToggle("slow");		
		$(this).toggleClass("active"); return false;
	});		
	
	$(".price_3").click(function(){
		$("#PricePanel_2").slideUp("slow");
		$("#PricePanel_1").slideUp("slow");
			
		$("#PricePanel_3").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});	
	
	
	///--------- my test
	
	$("#test_1").hover(function(){
		//$("#test_1_2").slideToggle("slow");		
		$("#test_1_2").animate({bottom:'30px'});
		$(this).toggleClass("active");
		return false;
	});
	
	$("#test_2").hover(function(){
		$("#test_2_2").slideToggle("slow", "easeout");		
		$(this).toggleClass("active");
		
		$("#test_1_2").slideUp("slow");
		$("#test_3_2").slideUp("slow");
		
		return false;
	});
	
	$("#test_3").hover(function(){
		$("#test_3_2").slideToggle("slow");		
		$(this).toggleClass("active");
		
		$("#test_2_2").slideUp("slow");
		$("#test_1_2").slideUp("slow");
		
		return false;
	});
	
	//-----------------
	
   /*  $("#various").fancybox();*/
	
});

function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (navigator.appName) t = 'Netscape';
 return {type:t,version:v};
}
 
function bookmark(a){
 var url = window.document.location;
 var title = window.document.title;
 //var title = "студия Dominari - создание сайтов";
 var b = getBrowserInfo();
 if (b.type == 'IE' && 9 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Press CTRL-D to bookmark.");	
 
 return false;
}



