function resize(){
	if($(window).width() < 1110){/*jei mazas*/
		$('#container').css('width', '1000px');
		if($.browser.msie && $.browser.version == 6) {
			$('#main_column').css('width', '693px');
		} else {
			$('#main_column').css('width', '695px');
		}
		$('#adv-template .body .right-col h2').css('margin-left', '10px');
		$('#adv-template2 .body .right-col h2').css('margin-left', '10px');
		$('#adv-template .body .left-col').css('width', '240px');
		$('#adv-template2 .body .left-col').css('width', '240px');
		$('#adv-template .body .right-col').css('width', '390px');
		$('#adv-template2 .body .right-col').css('width', '390px');
		$('#adv-template .body').css('background', 'transparent url(../images/cv_ad2_bg1_small.gif) repeat-y scroll 0 0');
		$('#adv-template2 .body').css('background', 'transparent url(../images/cv_ad2_bg1_small.gif) repeat-y scroll 0 0');
		$('#adv-template div#head table').css('width', '620px');
		$('#adv-template2 div#head table').css('width', '620px');
		$('#adv-template div#body table').css('width', '620px');
		$('#adv-template2 div#body table').css('width', '620px');
		$('#adv-template div#body table .cell1-first').css('width', '165px');
		$('#adv-template div#body table .cell1-first').css('width', '165px');
		$('#adv-template2 div#body table .cell1').css('width', '165px');
		$('#adv-template2 div#body table .cell1-first').css('width', '178px');
		$('.adv1_left_col').css('width', '240px');
		$('.adv1_right_col').css('width', '390px');
		$('.adv1_body').css('background', 'transparent url(../images/cv_ad2_bg1_small.gif) repeat-y scroll 0 0');
		$('.adv1_h2_2_wr').css('margin-left', '11px');
		$('#adv1_underline').css('background', 'url(../images/cv_ad2_bg2_small.gif) no-repeat center bottom');
	}else{/*jei didelis*/
		$('#container').css('width', '1110px');
		if($.browser.msie && $.browser.version == 6) {
			$('#main_column').css('width', '803px');
		} else {
			$('#main_column').css('width', '805px');
		}
		$('#adv-template .body .right-col h2').css('margin-left', '0px');
		$('#adv-template2 .body .right-col h2').css('margin-left', '0px');
		$('#adv-template2 .body .left-col').css('width', '290px');
		$('#adv-template .body .right-col').css('width', '450px');
		$('#adv-template2 .body .right-col').css('width', '450px');
		$('#adv-template .body').css('background', 'transparent url(../images/cv_ad2_bg1.gif) repeat-y scroll 0 0');
		$('#adv-template2 .body').css('background', 'transparent url(../images/cv_ad2_bg1.gif) repeat-y scroll 0 0');
		$('#adv-template div#head table').css('width', '730px');
		$('#adv-template2 div#head table').css('width', '730px');
		$('#adv-template div#body table').css('width', '730px');
		$('#adv-template2 div#body table').css('width', '730px');
		$('#adv-template div#body table .cell1-first').css('width', '193px');
		$('#adv-template2 div#body table .cell1-first').css('width', '193px');
		$('#adv-template div#body table .cell1').css('width', '180px');
		$('#adv-template2 div#body table .cell1').css('width', '180px');
		$('.adv1_left_col').css('width', '290px');
		$('.adv1_right_col').css('width', '450px');
		$('.adv1_body').css('background', 'transparent url(../images/cv_ad2_bg1.gif) repeat-y scroll 0 0');
		$('.adv1_h2_2_wr').css('margin-left', '0');
		$('#adv1_underline').css('background-image', 'url(../images/cv_ad2_bg2.gif)');
	}
}
$(document).ready(function(){
	$('[data-error_msg]').each(function(i, element){
		element.oninvalid = function(e){
			if (!e.target.validity.valid){
				var msg;
				if (e.target.validity.typeMismatch && typeof $(element).data('error_type') != 'undefined') {
					msg = $(element).data('error_type');
				} else if (e.target.validity.patternMismatch && typeof $(element).data('error_pattern') != 'undefined') {
					msg = $(element).data('error_pattern');
				} else {
					msg = $(element).data('error_msg');
				}
				e.target.setCustomValidity( msg );
			}
			setTimeout(function(){e.target.setCustomValidity('')}, 100, e);
		}
	});

	$('.cvb_popup').click(function(e){
		e.preventDefault(e);
		var optArr ={
			'width'		: '800',
			'height'	: '600'
		};
		var tmpAttr;
		tmpAttr = $(this).data('pop_w');
		if (typeof tmpAttr != 'undefined') {
			optArr.width = tmpAttr;
		}
		tmpAttr = $(this).data('pop_h');
		if (typeof tmpAttr != 'undefined') {
			optArr.height = tmpAttr;
		}

		var optStr = 'width=' + optArr.width + ',height=' + optArr.height + ',scrollbars=yes,toolbar=no,menubar=no,status=no';
		window.open($(this).attr('href'),'',optStr);
	});
});
