// JavaScript Document


var text7 = new Array;
text7[0] = '<div class="t1 heightT"></div>';
text7[1] = '<div class="t2 heightT"></div>';
text7[2] = '<div class="t3 heightT"></div>';
text7[3] = '<div class="t4 heightT"></div>';
text7[4] = '<div class="t5 heightT"></div>';
text7[5] = '<div class="t6 heightT"></div>';
text7[6] = '<div class="cont"></div>';
text7[7] = '<div class="b1 heightB"></div>';
text7[8] = '<div class="b2 heightB"></div>';
text7[9] = '<div class="b3 heightB"></div>';
text7[10] = '<div class="b4 heightB"></div>';
text7[11] = '<div class="b5 heightB"></div>';
text7[12] = '<div class="b6 heightB"></div>';

var i1 = '<img src="/a0/ru/images/RCpng/banTop.png" class="RCTop" height="7" width="236" />';
var i2 = '<img src="/a0/ru/images/RCpng/banBottom.png" class="RCBottom" height="7" width="236" />';

$.fn.roundCorner7px = function(){
	//_();
	var href = $(this).children('a').attr('href');
	text7[13] = '<a href="'+href+'"></a>';
	var content = text7.join('');
	var images = $('img', this);
	var imagesSrc = images[0].src;
	var imagesWidth = images.width();
	var imagesHeight = images.height();
	$(this).css({height:imagesHeight+'px', width:imagesWidth+'px'})[0].innerHTML = content;
	$('.heightT', this).css('backgroundImage', 'url('+imagesSrc+')');
	$('.heightB', this).css('backgroundImage', 'url('+imagesSrc+')');
	$('.cont', this).height(imagesHeight-12).css('background', 'url('+imagesSrc+') left -6px');
	//_(imagesSrc);
	for(var i=1; i<=6;i++){
		var leftBg;
		switch(i){
			case 1:
				leftBg = '-0px';
				break;
			case 2:
				leftBg = '-0px';
				break;
			case 3:
				leftBg = '-1px';
				break;
			case 4:
				leftBg = '-2px';
				break;
			case 5:
				leftBg = '-3px';
				break;
			case 6:
				leftBg = '-5px';
				break;
		}
		$(('.b'+i), this).css('backgroundPosition', leftBg +' -'+(imagesHeight-(8-i))+'px');
		//_($('.b'+i).css('backgroundPosition'));
	}
//	images.hide();
	//_(imagesHeight);
	this.css('background','none').append(i1, i2);
}








//=======================================================
//10px
var text10 = new Array;
text10[0] = '<div class="t1_10 heightT"></div>';
text10[1] = '<div class="t2_10 heightT"></div>';
text10[2] = '<div class="t3_10 heightT"></div>';
text10[3] = '<div class="t4_10 heightT"></div>';
text10[4] = '<div class="t5_10 heightT"></div>';
text10[5] = '<div class="t6_10 heightT"></div>';
text10[6] = '<div class="t7_10 heightT"></div>';
text10[7] = '<div class="t8_10 heightT"></div>';
text10[8] = '<div class="t9_10 heightT"></div>';
text10[9] = '<div class="t10_10 heightT"></div>';
text10[10] = '<div class="cont_10"></div>';
text10[11] = '<div class="b1_10 heightB"></div>';
text10[12] = '<div class="b2_10 heightB"></div>';
text10[13] = '<div class="b3_10 heightB"></div>';
text10[14] = '<div class="b4_10 heightB"></div>';
text10[15] = '<div class="b5_10 heightB"></div>';
text10[16] = '<div class="b6_10 heightB"></div>';
text10[17] = '<div class="b7_10 heightB"></div>';
text10[18] = '<div class="b8_10 heightB"></div>';
text10[19] = '<div class="b9_10 heightB"></div>';
text10[20] = '<div class="b10_10 heightB"></div>';




$.fn.roundCorner10px = function(size){
	var content = text10.join('');
	var images = $('img', this);
	var imagesSrc = images[0].src;
	var imagesWidth = images.width();
	var imagesHeight = images.height();
	$(this).css({height:imagesHeight+'px', width:imagesWidth+'px'})[0].innerHTML = content;
	$('.heightT', this).css('backgroundImage', 'url('+imagesSrc+')');
	$('.heightB', this).css('backgroundImage', 'url('+imagesSrc+')');
	$('.cont_10', this).height(imagesHeight-20).css('background', 'url('+imagesSrc+') left -10px');
	//_(imagesSrc);
	for(var i=1; i<=10;i++){
		var leftBg;
		switch(i){
			case 1:
				leftBg = '0px';
				break;
			case 2:
				leftBg = '0px';
				break;
			case 3:
				leftBg = '1px';
				break;
			case 4:
				leftBg = '0px';
				break;
			case 5:
				leftBg = '0px';
				break;
			case 6:
				leftBg = '-1px';
				break;
			case 7:
				leftBg = '-2px';
				break;
			case 8:
				leftBg = '-3px';
				break;
			case 9:
				leftBg = '-5px';
				break;
			case 10:
				leftBg = '-8px';
				break;
		}
		$(('.b'+i+'_10'), this).css('backgroundPosition', leftBg +' -'+(imagesHeight-(12-i))+'px');
	}
//	images.hide();
	//_(imagesHeight);
	switch(size){
		case 'd':
			var fI1 = i1_p;
			var fI2 = i2_p;
			break;
		case 'b':
			var fI1 = i1_pBig;
			var fI2 = i2_pBIG;
			break;
		case 's':
			var fI1 = i1_pSmall;
			var fI2 = i2_pSmall;
			break;
		case 'bigger':
			var fI1 = i1_pBiger;
			var fI2 = i2_pBiger;
			break;
		case 'hall':
			var fI1 = i1_pHall;
			var fI2 = i2_pHall;
			break;
	}
	this.css({background:'none', border:'none'}).append(fI1, fI2);
}


var i1_p = '<img src="/a0/ru/images/RCpng/posterTop.png" class="RCTop" height="12" width="181" />';
var i2_p = '<img src="/a0/ru/images/RCpng/posterBottom.png" class="RCBottom" height="12" width="181" />';

var i1_pSmall = '<img src="/a0/ru/images/RCpng/posterSmallTop.png" class="RCTop" height="12" width="149" />';
var i2_pSmall = '<img src="/a0/ru/images/RCpng/posterSmallBottom.png" class="RCBottom" height="12" width="149" />';

var i1_pBig = '<img src="/a0/ru/images/RCpng/posterTopBig.png" class="RCTop" height="12" width="220" />';
var i2_pBIG = '<img src="/a0/ru/images/RCpng/posterBottomBig.png" class="RCBottom" height="12" width="220" />';

var i1_pBiger = '<img src="/a0/ru/images/RCpng/posterBiggerTop.png" class="RCTop" height="12" width="457" />';
var i2_pBiger = '<img src="/a0/ru/images/RCpng/posterBiggerBottom.png" class="RCBottom" height="12" width="457" />';


var i1_pHall = '<img src="/a0/ru/images/RCpng/posterHallTop.png" class="RCTop" height="12" width="488" />';
var i2_pHall = '<img src="/a0/ru/images/RCpng/posterHallBottom.png" class="RCBottom" height="12" width="488" />';


//=======================================================
//px
var text5 = new Array;
text5[0] = '<div class="t1_5 heightT"></div>';
text5[1] = '<div class="t2_5 heightT"></div>';
text5[2] = '<div class="t3_5 heightT"></div>';
text5[3] = '<div class="t4_5 heightT"></div>';
text5[4] = '<div class="cont_5"></div>';
text5[5] = '<div class="b1_5 heightB"></div>';
text5[6] = '<div class="b2_5 heightB"></div>';
text5[7] = '<div class="b3_5 heightB"></div>';
text5[8] = '<div class="b4_5 heightB"></div>';

var i1_i = '<img src="/a0/ru/images/RCpng/imagesTop.png" class="RCTop" height="5" width="141" />';
var i2_i = '<img src="/a0/ru/images/RCpng/imagesBottom.png" class="RCBottom" height="5" width="141" />';

var i1_iBIG = '<img src="/a0/ru/images/RCpng/imagesBigTop.png" class="RCTop" height="5" width="199" />';
var i2_iBIG = '<img src="/a0/ru/images/RCpng/imagesBigBottom.png" class="RCBottom" height="5" width="199" />';

$.fn.roundCorner5px = function(size){
	var content = text5.join('');
	var images = $('img', this);
	var imagesSrc = images[0].src;
	var imagesWidth = images.width();
	var imagesHeight = images.height();
	$(this).css({height:imagesHeight+'px', width:imagesWidth+'px'})[0].innerHTML = content;
	$('.heightT', this).css('backgroundImage', 'url('+imagesSrc+')');
	$('.heightB', this).css('backgroundImage', 'url('+imagesSrc+')');
	$('.cont_5', this).height(imagesHeight-8).css('background', 'url('+imagesSrc+') left -4px');
	//_(imagesSrc);
	for(var i=1; i<=4;i++){
		var leftBg;
		switch(i){
			case 1:
				leftBg = '0px';
				break;
			case 2:
				leftBg = '0px';
				break;
			case 3:
				leftBg = '-1px';
				break;
			case 4:
				leftBg = '-3px';
				break;
		}
		$(('.b'+i+'_5'), this).css('backgroundPosition', leftBg +' -'+(imagesHeight-(6-i))+'px');
	}
//	images.hide();
	//_(imagesHeight);
	if(size=='d'){
		var fI1 = i1_i;
		var fI2 = i2_i;
	}
	if(size=='b'){
		var fI1 = i1_iBIG;
		var fI2 = i2_iBIG;
	}
	this.css({background:'none', border:'none'}).append(fI1, fI2);
}

var ie = $.browser.msie;
var opera = $.browser.opera;

$(function(){
		   if(ie || opera){
	$('.siteBarBan .blockItem').each(function(){
											  $(this).roundCorner7px();
											  });
	//alert('test1');

  $('.eventPage .posterPhoto').each(function(){
									  $(this).roundCorner10px('d');
									  });
	$('.poster .posterPhoto').each(function(){
											  $(this).roundCorner10px('b');
											  });
	
	$('.eventList .posterPhoto:visible').each(function(){
											  $(this).roundCorner10px('s');
											  });
	$('.posterPhotoGalery:visible').each(function(){
											  $(this).roundCorner10px('bigger');
											  });
	$('.planOfHall').each(function(){
											  $(this).roundCorner10px('hall');
											  });
	//alert('test1');

		   
	$('.photoGalery .images:visible').each(function(){
											  $(this).roundCorner5px('d');
											  });
	$('.partners .images').each(function(){
											  $(this).roundCorner5px('b');
											  });
		   }
	//alert('test1');
});





