jQuery.noConflict();

function doSofa(){
	th=jQuery(window).innerHeight();
	tw=jQuery(window).innerWidth();
	if(th>760 && tw>1210) {
		sw=1200;
		sh=480;
		rl=760;
	} else if(th>660 && tw>960) {
		sw=950;
		sh=381;
		rl=560;
	} else if(th>560 && tw>760) {
		sw=750;
		sh=300;
		rl=460;
	}  else {
		sw=500;
		sh=200;
		rl=310;
	}
	jQuery('#news').css('width',(tw-363)+'px');
	jQuery('#gall').css('width',jQuery('#page').width()+'px');
	jQuery('#head').css('width',tw+'px');
	if(jQuery('#sofa').length>0) {
		jQuery('#sofa').css('height',sh+'px');
		jQuery('#sofa').css('backgroundImage','url(/html/img/bbmb_sofa_'+sw+'.gif)');
		jQuery('#picrah').css('left',rl+'px');
		if(th<480) {
			jQuery('#sofa').css('backgroundImage','none');
		}
	}
}
window.onresize = doSofa;

i=0;
j=2;
sts=false;
function scrollTicker(el,sp){
	jQuery(el).mouseover(function(){sts=true;runScrollTicker(el,sp)});
	jQuery(el).mouseout(function(){sts=false;runScrollTicker(el,sp)});
	runScrollTicker(el,sp);
}
function runScrollTicker(el,sp){
	i=i-1;
	jQuery(el+' ul').css('left',i);
	f='runScrollTicker("'+el+'",'+sp+')';
	if(sts!=true || i==-1) {
		if((jQuery(el+' ul li:nth-child('+j+')').offset()['left'])<jQuery(el).offset()['left'] || i==-1) {
			jQuery(el+' ul li:nth-child('+(j-1)+')').clone().appendTo(el+' ul');
			jQuery(el+' ul li:nth-child('+(j)+')').clone().appendTo(el+' ul');
			jQuery(el+' ul li:nth-child('+(j+1)+')').clone().appendTo(el+' ul');
			j++;
		}
		setTimeout(f,sp);
	}
}

jQuery(document).ready(function(){

	doSofa();

	jQuery('a[@href$="mp3"]').flash(
		{ src: '/html/script/singlemp3player.swf', height: 20, width: 345 },
		{ version: 7 },
		function(htmlOptions) {
			$this = jQuery(this);
			htmlOptions.flashvars.file = $this.attr('href');
			$this.after(jQuery.fn.flash.transform(htmlOptions));
			$this.after('<div class="mp3Show">');
			$this.before('</div>');
			$this.remove();
		}
	);

	if(jQuery('#news').length>0) scrollTicker('#news',30);
	if(jQuery('#gall').length>0) scrollTicker('#gall',30);

});


