/* 
 * Designed by Lewonchik
 * ICQ: 425 510 763
 * http://webstory.ucoz.net 
 */

 $(function()
 {
 // Call stylesheet init so that all stylesheet changing functions 
 // will work.
 $.stylesheetInit();
 
 // This code loops through the stylesheets when you click the link with 
 // an ID of "toggler" below.
 $('#toggler').bind(
 'click',
 function(e)
 {
 $.stylesheetToggle();
 return false;
 });
 
 // When one of the styleswitch links is clicked then switch the stylesheet to
 // the one matching the value of that links rel attribute.
 $('.styleswitch').bind(
 'click',
 function(e)
 {
 $.stylesheetSwitch(this.getAttribute('rel'));
 return false;
 });
 
 // Menu function slow
 $("ul li").hover(function(){
   $(this).find('ul:first').css({visibility: "visible",display: "none"}).slideToggle('300');
   },function(){$(this).find('ul:first').css({visibility: "hidden"}); });
 
 // Checkbox functions
chbox={t:'/images/Check.png',f:'/images/UnCheck.png'} //Picture in checkbox. t: on, f: off.
rbox={t:'/images/RCheck.png',f:'/images/RUnCheck.png'} //Picture in radio. t: on, f: off.
// 
$('input[type="checkbox"]').each(function(){this.style.display='none';if(this.checked){$(this).after('<img src="'+chbox.t+'" align="absmiddle">');}else{$(this).after('<img src="'+chbox.f+'" align="absmiddle">');}$(this).bind('click',function(){if(this.checked){$(this).next('img').attr('src',chbox.t)}else{$(this).next('img').attr('src',chbox.f)}});$(this).next('img').bind('click',function(){$(this).prev('input').click();if($(this).prev('input').attr('checked')){this.src=chbox.t;}else{this.src=chbox.f;}});});
$('input[type="radio"]').each(function(){this.style.display='none';if(this.checked){$(this).after('<img src="'+rbox.t+'" align="absmiddle">');}else{$(this).after('<img src="'+rbox.f+'" align="absmiddle">');}var rgroup=this.name;$(this).bind('click',function(){$('input[name="'+rgroup+'"]').each(function(){$(this).next('img').attr('src',rbox.f)});$(this).next('img').attr('src',rbox.t);});$(this).next('img').bind('click',function(){$(this).prev().click();});});

 
 // Quote end Code functions
 $('.bbCodeBlock').find('.codeMessage').removeAttr('style').css({overflow:'auto', maxHeight:'300px'}).end()
 .find('.bbCodeName').removeAttr('style').html('<b>Листинг кода:</b>').end();
 $('.bbQuoteBlock').find('.quoteMessage').removeAttr('style').end()
 .find('.bbQuoteName').removeAttr('style').prepend('<b>Цитата</b>').append(' :').find('.qName').prev('b').remove();
  
 });
