/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
var TB_FADEOUT_SPEED    ='medium';
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
$(document).ready(function(){   
	tb_init('a.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = "http://src.ucoz.ru/img/wd/3/ajax.gif";
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	$(domChunk).click(function(){
	tb_show(this.href);
	this.blur();
	return false;
	});
}

function tb_show(url) {//function called when the user clicks on a thickbox link

		$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
		$("#TB_overlay").click(tb_remove);
		$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		
		$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		$('#TB_load').show();//show loader
			
        var params = '';

         TB_WIDTH = 712; //defaults to 630 if no paramaters were added to URL
         TB_HEIGHT = 440; //defaults to 440 if no paramaters were added to URL
         ajaxContentW = TB_WIDTH - 30;
         ajaxContentH = TB_HEIGHT - 45;


         $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>Полное описание</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Закрыть окно'>Закрыть</a></div></div><div id='TB_ajaxContent'><iframe frameborder='0' hspace='0' style='width:"+ajaxContentW+"px; height:"+ajaxContentH+"px' src='http://party-center.ru/"+url+"' > </iframe></div>");


			$("#TB_closeWindowButton").click(tb_remove);
			$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
			$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
			$("#TB_load").remove();
			$("#TB_window").css({display:"block"}); 
		
}

function tb_remove() {
 	$("#TB_imageOff").unbind("click");
	$("#TB_closeWindowButton").unbind("click");
	$("#TB_window").fadeOut(TB_FADEOUT_SPEED,function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	$("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}



