jQuery.noConflict();

jQuery(document).ready(function(){// onload RUN
		
	//prepend span tag to H1 (gradient)
 	//jQuery("h1, h2").prepend("<span></span>");
		
	jQuery('#content_column').css('width',contentWidth);
			
	onResize();
	
	// remove focus
	jQuery("a").click(function(){jQuery(this).blur();});
	
	// fixPNG function
	jQuery("img[@src$=png]").pngfix();
	
	// apend corners & detecting browser version
	if (jQuery.browser.msie) {
		if (parseInt(jQuery.browser.version) >= 7) {
			 jQuery(".rounded").prepend(corners_white);
		} else {
			jQuery(".workinprogress").remove();
		}
	} else {
		jQuery(".rounded").prepend(corners_white);
	}
	
	// onresize обработчик
	jQuery(window).bind('resize', function() { 
		onResize();
	});
	
	// contacts form extra fields
	jQuery("#attachBtn").click(function(){ jQuery("#uploadfields").toggle("slow"); jQuery(".uplBtn").toggle(); } );
	jQuery("#extrafieldsBtn").click(function(){  jQuery("#extrafields").toggle("slow");jQuery(".extraBtn").toggle(); } );
	// price extra fields
	jQuery("#price1btn").click(function(){ jQuery("#price1").toggle("slow"); jQuery(".pr1btn").toggle(); } );
	jQuery("#price2btn").click(function(){ jQuery("#price2").toggle("slow"); jQuery(".pr2btn").toggle(); } );
	
	//
	jQuery(".partner img").mouseover(function () { jQuery(this).fadeTo(300, 0.5);}).mouseout(function () { jQuery(this).fadeTo(300, 1);	});
});

// corners
var corners_white = '<img src="/images/it_megapolis_tmp2/corner-white-tl.png" class="tl" alt="" />'+'<img src="/images/it_megapolis_tmp2/corner-white-tr.png" class="tr" alt="" />'+'<img src="/images/it_megapolis_tmp2/corner-white-bl.png" class="bl" alt="" />'+'<img src="/images/it_megapolis_tmp2/corner-white-br.png" class="br" alt="" />';

// mail cloacking
String.prototype.build = 
function (_hamper,_prefix,_postfix,_face) // hidemail
{
	  _hamper=
	  _prefix+
	  "@"+
	  this+
	  (_postfix || '')
	  document.write((_face||_hamper).link("mailto:"+_hamper));
}

// resize dinamic
function onResize(){
	
	if(document.body.clientWidth > 1200) { 
		jQuery("#icon1, #icon2, #icon3, #icon4").css("width","24%");
		jQuery("#icon4").css("display","inline"); // отображаем 4-ю иконку в списке работ на главной
		
		// 3-колоночная динамика
		jQuery(".content_column").css("width",contentWidth+"%"); //
		jQuery(".col_1").css("width","17%"); //
		jQuery(".col_2").css("display","inline"); //
		if(document.body.clientWidth > 1500) {
			jQuery(".portfolio_div").css("width","25%"); //
		} else {
			jQuery(".portfolio_div").css("width","33%"); //
		}
		
	} else {
		jQuery("#icon1, #icon2, #icon3, #icon4").css("width","33%");
		jQuery("#icon4").css("display","none");
		
		// 3-колоночная динамика
		jQuery(".col_2").css("display","none"); //
		if (!singleCol) { jQuery(".content_column").css("width",contentWidth+15+"%") } else { jQuery(".content_column").css("width",contentWidth+"%") }; //
		jQuery(".col_1").css("width","22%"); //
		jQuery(".portfolio_div").css("width","33%"); //
	}
};
