    $(document).ready(
	function() {
	    
	    function resize() {
		$("iframe[id=comp]").each(
		    function () {
			this.style.height = this.contentWindow.document.body.scrollHeight + 'px';
		    }
		);
		
		$("iframe[id=voting]").each(
		    function () {
			this.style.height = this.contentWindow.document.body.scrollHeight + 'px';
		    }
		);
		
	    }
	
	    if ($.browser.safari || $.browser.opera) {
		$('iframe').load(
		    function() {
		    	setTimeout(resize, 0);
		    }
		);	
		
		/*$("iframe[@id=comp]").each(
		    function() {
			src = this.src;
			this.src = '';
			this.src = src;
		    }
		);
		
		$("iframe[@id=voting]").each(
		    function() {
			src = this.src;
			this.src = '';
			this.src = src;
		    }
		);*/


	    } else {
		resize();
	    }
	    
	}
    );
    
    
    
    function loadXML(id, url) {
		$.ajax({
	    	    url: "/poll/get/",
	    	    type: "POST",
		    data: "id=" + id + "&url=" + url,
		    dataType: "xml",
		    
		    success : function(XML) {
	    	        if($("#show_poll_result", XML)) {
			    score = $("#score", XML).text();
			    raw_score = $("#raw_score", XML).text();
			    
			    $("#poll_old").css("display", "none");
			    $("#poll_result").append("<img src=\"/i/bar/p" + score + ".png\" alt=\"������� " + raw_score + "\"> [ " + raw_score + " ]");
	
		        }
		    }
		});
    
    }
    
    
    function forum_xml(category) {
		$.ajax({
	    	    url: "/forum/?part=1&category=" + category,
	    	    type: "GET",
		    dataType: "xml",
		    
		    success : function(XML) {
			$("item", XML).each(function(){
			    $("<span><a href=\"http://forum.3dnews.ru/thread.php?f=" + $("forumid", this).text() + "&t=" + $("threadid", this).text() + "\" target=\"_blank\">" + $("title", this).text() + "</a>(" + $("reply", this).text() + ")</span><br>").appendTo("#forum1");
			});
		    }
		});
		
		$.ajax({
	    	    url: "/forum/?part=2&category=" + category,
	    	    type: "GET",
		    dataType: "xml",
		    
		    success : function(XML) {
			$("item", XML).each(function(){
			    $("<span><a href=\"http://forum.3dnews.ru/thread.php?f=" + $("forumid", this).text() + "&t=" + $("threadid", this).text() + "\" target=\"_blank\">" + $("title", this).text() + "</a>(" + $("reply", this).text() + ")</span><br>").appendTo("#forum2");
			});
		    }
		});	

    }
    
    function sbhide(){
    	
    	if($('#subscriber').css('visibility')=="visible"){
    		
    		$('#subscriber').css('visibility','hidden');
    		$('#subscriber').css('display','none');
    		
    	}
    	
    }
    
    function sbshow(){
    	
    	$('#subscriber').css('visibility','visible');
    	$('#subscriber').css('display','block');
    	$('#subscriber').css('margin-top','-1px');
    	$('#subscriber').css('left','653px');
    	$('#subscriber').css('clear','none');
    	
    }
    
    function addToFav(){

    	var title = '3DNews - Daily Digital Digest';
    	var url = 'http://www.3dnews.ru';

    	if (window.sidebar)
    		window.sidebar.addPanel(title, url, "");
    	else if(window.opera && window.print){
    		var elem = document.createElement('a');
    		elem.setAttribute('href',url);
    		elem.setAttribute('title',title);
    		elem.setAttribute('rel','sidebar');
    		elem.click();
    	} else if(document.all)
    		window.external.AddFavorite(url, title);
    
    }
    
