
//Узнаем ширину и высоту страницы
function documentSize() {
if(document.width && document.height) {
	w=document.width;
	h=document.height;
}
if(document.body.scrollWidth && document.body.scrollHeight) {
	w=document.body.scrollWidth;
	h=document.body.scrollHeight;
}
if(document.body.style.pixelWidth && document.body.style.pixelHeight) {
	w=document.body.style.pixelWidth;
	h=document.body.style.pixelHeight;
}
  return {"w":w, "h":h};
}
   
$(document).ready(function()
    {
        $(".littleGalleryPic").click(function()
            {
                n = $(this).attr("id").substr(1,1);
             
               $("#divout"+n+" .actGallery").removeClass("actGallery");
        
               $(this).removeClass("littleGalleryPic");
               $(this).addClass("actGallery");
     
               $("#imgCatalog"+n).attr("src", fotoCatalog[n-1][($(this).attr("id")).substr(2)-1]);


            });
			
			
			
    });
    
$(document).ready(function()
    {
        $(".registrationOnForum").click(function()
            {
				$(".backgroundReg").css("width", documentSize().w);
			  	$(".backgroundReg").css("height", $(document).height());
  				$(".backgroundReg").css("opacity", "0.6");
                $(".backgroundReg").fadeIn("fast");
                $(".registration").animate({top: "153"}, "slow");
                
            });
            
        $(".backgroundReg").click(function()
            {
                $(".registration").animate({top: "-500"}, "slow");
                $(".backgroundReg").fadeOut("fast");
                
            });
    });
    
    function myResize () {
	$(".backgroundReg").css("width", documentSize().w);
  	$(".backgroundReg").css("height", $(document).height());
    }
/*$(document).ready(function() {
	myResize (); // по загрузке
});*/
$(window).resize(function(){
	myResize (); // по изменению размеров
});

/*верхнее меню*/
$(document).ready(function()
    {
        $(".carsLink").hover
            ( function() {
            	k = $(this).attr("id").substr(8);
		$("#carsLink"+k+" a").css("color","#ffffff");
		//alert($(this).css("background-image"));
		//alert(this.style.background);
		this.style.backgroundImage="url('../d/lineTopMenu"+k+"act.gif')";
		//alert(this.style.backgroundImage);
		//$(this).removeClass("carsLink"+k);
		//$(this).addClass("carsLink"+k+"act");
		//alert($(this).css("background-image"));
	    }, function() {
		$("#carsLink"+k+" a").css("color","#F3AD00");
		this.style.backgroundImage="url('../d/lineTopMenu"+k+".gif')";
		//$(this).removeClass(".carsLink"+k+"act");
		//$(this).addClass("carsLink"+k);
	    });
    });
    
    
/*min-width для IE6*/
var d = document;
var winIE = (navigator.userAgent.indexOf('Opera')==-1 && (d.getElementById && d.documentElement.behaviorUrns)) ? true : false;

function bodySize(){
	if(winIE && d.documentElement.clientWidth) {
	sObj = d.getElementsByTagName('body')[0].style;
	sObj.width = (d.documentElement.clientWidth<1003) ? '1003px' : '100%';
	}
}

function init(){
  	if(winIE) { bodySize(); }
}
onload = init;
if(winIE) { onresize = bodySize; }

/*цитирование*/
function cit(val,usr) {
                     var from = document.getElementById(val);
                  
                     var to = document.getElementById("msg");
                     if(from !=null) {
                        to.value +='<cit> <autor> '+usr+' написал(а): </autor>'
 + from.innerHTML +
 '</cit>'
                     }
}

function showcontent(a){
    if ($(a).text()=="читать далее"){
        $(a).text("скрыть")
    } else $(a).text("читать далее");
    $("#hk").toggle("slow");
	
    return false;
}        
