/*

function var_dump(data,addwhitespace,safety,level) {
        var rtrn = '';
        var dt,it,spaces = '';
        if(!level) {level = 1;}
        for(var i=0; i<level; i++) {
           spaces += '   ';
        }//end for i<level
        if(typeof(data) != 'object') {
           dt = data;
           if(typeof(data) == 'string') {
              if(addwhitespace == 'html') {
                 dt = dt.replace(/&/g,'&amp;');
                 dt = dt.replace(/>/g,'&gt;');
                 dt = dt.replace(/</g,'&lt;');
              }//end if addwhitespace == html
              dt = dt.replace(/\"/g,'\"');
              dt = '"' + dt + '"';
           }//end if typeof == string
           if(typeof(data) == 'function' && addwhitespace) {
              dt = new String(dt).replace(/\n/g,"\n"+spaces);
              if(addwhitespace == 'html') {
                 dt = dt.replace(/&/g,'&amp;');
                 dt = dt.replace(/>/g,'&gt;');
                 dt = dt.replace(/</g,'&lt;');
              }//end if addwhitespace == html
           }//end if typeof == function
           if(typeof(data) == 'undefined') {
              dt = 'undefined';
           }//end if typeof == undefined
           if(addwhitespace == 'html') {
              if(typeof(dt) != 'string') {
                 dt = new String(dt);
              }//end typeof != string
              dt = dt.replace(/ /g,"&nbsp;").replace(/\n/g,"<br>");
           }//end if addwhitespace == html
           return dt;
        }//end if typeof != object && != array
        for (var x in data) {
           if(safety && (level > safety)) {
              dt = '*RECURSION*';
           } else {
              try {
                 dt = var_dump(data[x],addwhitespace,safety,level+1);
              } catch (e) {continue;}
           }//end if-else level > safety
           it = var_dump(x,addwhitespace,safety,level+1);
           rtrn += it + ':' + dt + ',';
           if(addwhitespace) {
              rtrn += '\n'+spaces;
           }//end if addwhitespace
        }//end for...in
        if(addwhitespace) {
           rtrn = '{\n' + spaces + rtrn.substr(0,rtrn.length-(2+(level*3))) + '\n' + spaces.substr(0,spaces.length-3) + '}';
        } else {
           rtrn = '{' + rtrn.substr(0,rtrn.length-1) + '}';
        }//end if-else addwhitespace
        if(addwhitespace == 'html') {
           rtrn = rtrn.replace(/ /g,"&nbsp;").replace(/\n/g,"<br>");
        }//end if addwhitespace == html
        return rtrn;
     }//end function var_dump

*/

jQuery(document).ready(function(){	
								
	//$('textarea.cke').ckeditor();							

	$('.foc').hover(function()
		{
		$(this).css("background","#FFFFFF");
		$(this).css("cursor","pointer");
		$(".pic_video").attr("src","/upload/video_blog_flv/"+$(this).attr("ids")+".jpg");
		return false;
		},
		function(){
		$(this).css("background","#F0F0F0");	
		return false;
		}
		);

	$('.foc').click(function()
		{
		document.location=$(this).find("a").attr("href");
		return false;
		}
		);		

	$('.hlink').click(function()
		{
		document.location=$(this).attr("obj");
		return false;
		}
		);
	
	$('.hlink_nohover a').click(function()
		{
		document.location=$(this).attr("href");
		return false;
		}
		);

	$('.hlink_nohover').click(function()
		{
		document.location=$(this).attr("obj");
		return false;
		}
		);

	$('a.show').click(function()
		{
		$(".content_in").empty();
		$(".content_in").append('<img src="/style/default/ru/img/ajax-loader.gif"><br>Загрузка...');
		$(".content_in").load("http://"+window.location.hostname+"/load"+$(this).attr("href"));
		return false;
		}
		);
	
	
		$("#searchBox").click(function() {
             $("#searchBox").attr("value","");
        });

	$('a.load').click(function()
		{
		$("."+$(this).attr("obj")).empty();
		$("."+$(this).attr("obj")).append('<img src="/style/default/ru/img/ajax-loader.gif"><br>Загрузка...');
		$("."+$(this).attr("obj")).load("http://"+window.location.hostname+"/load"+$(this).attr("href"));
		return false;
		}
		);

	$('a.back').click(function()
		{
		$("."+$(this).attr("obj")).hide();
		//тут сделаем возврат на предыдущую страницу
		return false;
		}
		);

	$('.up_menu a').click(function(){
		$(".content_in").empty();
		$(".content_in").append('<img src="/style/default/ru/img/ajax-loader.gif"><br>Загрузка...');
		$(".content_in").load("http://"+window.location.hostname+"/load"+$(this).attr("href"));
		return false;
		});

	$('a.link').click(function(){
		$(".content_in").empty();
		$(".content_in").append('<img src="/style/default/ru/img/ajax-loader.gif"><br>Загрузка...');
		$(".content_in").load("http://"+window.location.hostname+"/load"+$(this).attr("href"));
		return false;
		});


	$('a.link').livequery('click', function(event) {
		$(".content_in").empty();
		$(".content_in").append('<img src="/style/default/ru/img/ajax-loader.gif"><br>Загрузка...');
		$(".content_in").load("http://"+window.location.hostname+"/load"+$(this).attr("href"));
		return false;
	    	});
	
	$('.myform').livequery(function()
		{
		$('.myform').ajaxForm({
		beforeSubmit: function() {
            $(".content_in").append('<img src="/style/default/ru/img/ajax-loader.gif"><br>Загрузка...');
			},
		target: '.content_in',
		success: function()
			{
			$('.content_in').fadeIn();
			}
			});
		});
	
	$('.csend').livequery(function()
		{
				$(this).ajaxForm({
				beforeSubmit: function() {
					$('#'+$(".csend").attr("obj")).append('<img src="/style/default/ru/img/ajax-loader.gif"><br>Загрузка...');
					//$("."+$(".csend").attr("hf")).hide();

					//alert(scope[3]['value']);
					},
				target: '#'+$(".csend").attr("obj"),
				success: function()
					{
					
					$('#'+$(".csend").attr("obj")).fadeIn("slow");
					//$("."+$(".csend").attr("rarea")).hide("slow");
					$("#"+$(".csend").attr("hf")).empty();
					//$("."+$(".csend").attr("hf")).append('<img src="/style/default/ru/img/ajax-loader.gif"><br>Загрузка...');
					//$("."+$(".csend").attr("hf")).load("http://"+window.location.hostname+"/load"+$(".csend").attr("trcontent"));
					//$("."+$(".csend").attr("hf")).show();
					//$("."+$(".csend").attr("rarea")).load("http://"+window.location.hostname+"/load"+$(".csend").attr("trcontent"));
					//$("textarea").val('');
					return false;
					}
					});
		});

	$('a.open').click(function()
		{
		$(".fcon").empty();
		$(".bcon").hide();
		$(".ccon").empty();
		$("#"+$(this).attr("obj")).toggle();
		$("#"+$(this).attr("obj")).load("http://"+window.location.hostname+"/load"+$(this).attr("ld"));
		/*
		var tx=$(this).attr("etext");
		
		if(tx !== undefined) {
		$("."+$(this).attr("hid")).toggle();
		$(this).attr("etext",$(this).text());
		$(this).empty();
		$(this).append(tx);		
		}
		*/
		return false;
		}
		);
	
	$('a.opinion').click(function()
		{
		$("."+$(this).attr("obj")).toggle();
		$("."+$(this).attr("hid")).toggle();
		return false;
		}
		);
	
	$('a.open').livequery('click', function(event) {
		$(".fcon").empty();
		$(".bcon").hide();
		$(".ccon").empty();
		$("#"+$(this).attr("obj")).toggle();
		$("#"+$(this).attr("obj")).load("http://"+window.location.hostname+"/load"+$(this).attr("ld"));
		return false;
	    	});
	
	$('a.openall').click(function()
		{
			$("."+$(this).attr("obj")).toggle();
			return false;
		}
	);	
	
	$('.openone').click(function()
		{
			$("#"+$(this).attr("obj")).toggle();
			return false;
		}
	);		
	
		$('a.clink').livequery('click', function(event) {
		$('div[idc|='+$(this).attr("ids")+']').css("background","#96C737");
		$('.com'+$(this).attr("ids")).load("http://"+window.location.hostname+"/load"+$(this).attr("href"));
		return false;
	    	});
	
		$('a.zoom').livequery('click', function(event) {
		return hs.expand(this);
		return false;
	    	});
		
	$(".zoom").click(
		function(){
		return hs.expand(this);
		return false;
		});
	
	$(".adm_menu div:nth-child(1)").click(
		function(){
		$(this).parent("div").find("div:nth-child(2)").toggle();
		});
	
	$(".adm_menu div:nth-child(1)").hover(
		function(){
		$(this).css("background","#9C3");
		},
		function(){
		$(this).css("background","#DAA550");
		}
		);
	/*
	var imfff=document.URL;
	imfff=imfff.replace("http://","").replace(document.domain,"");
	$('.adm_menu div a[href|='+imfff+']').parent("div").show();
	$('.adm_menu div a[href|='+imfff+']').parent("div").show();
	$('.adm_menu div a[href|='+imfff+']').css("color","#FF0000");
	$('.adm_menu div a[href|='+imfff+']').css("font-weight","bold");
	*/
	var imfff=document.URL;
	imfff=imfff.replace("http://","").replace(document.domain,"");
	$('.hor_menu td a[href|='+imfff+']').parent("td").css("background","url(/img/bg_hor_menu_ch.png) repeat-x");
	$('.hor_menu td a[href|='+imfff+']').css("color","#FFF");
	$('.hor_menu td a[href|='+imfff+']').css("text-shadow","black 0px 0px 3px");
});

