var uploadForm = null;


function show_full(id) {
	if ($('#' + id).html() != '') {
		$('#' + id).show();
	}
}

function hide_full(id) {
	$('#' + id).hide();
}


function moveAndResizeContainer(xNew, yNew, widthNew, heightNew, Xmargin){
	
	xNew = parseInt(xNew);
	yNew = parseInt(yNew);
	widthNew = parseInt(widthNew);
	heightNew = parseInt(heightNew);

	$("#container").css('left', xNew);
	$("#container").css('top', yNew);
	$("#container").css('width', widthNew);
	$("#container").css('height', heightNew);
	
	$("#container_inner").css('min-height', heightNew);
	$("#container_inner").css('height', heightNew);
	$("#container_inner").css('width', widthNew);
	
	$('#auth').css('right', Xmargin);
	$('#support').css('margin-left', Xmargin);
	
}


function SetContainerLinks() {

	$('#container A, #auth_inner A').each(
		function() {

			var regExp = {
				doc: new RegExp('.*\.doc', 'i'),
				xls: new RegExp('.*\.xls', 'i'),
				jpg: new RegExp('.*\.jpg', 'i'),
				gif: new RegExp('.*\.gif', 'i'),
				ppt: new RegExp('.*\.ppt', 'i'),
				png: new RegExp('.*\.png', 'i'),
				mp4: new RegExp('.*\.mp4', 'i'),
				mp3: new RegExp('.*\.mp3', 'i'),
				avi: new RegExp('.*\.avi', 'i'),
				wmv: new RegExp('.*\.wmv', 'i'),
				cdr: new RegExp('.*\.cdr', 'i'),
				psd: new RegExp('.*\.psd', 'i'),
				flv: new RegExp('.*\.flv', 'i'),
				swf: new RegExp('.*\.swf', 'i')
			};

			for (var item in regExp) {
				
				if(regExp[item].test($(this).attr('href'))) {
					return;
				}
			}

			if ($(this).attr('target') == '_blank' ) {
				return;
			}

			$(this).click(function() {
				ChangeSiteURL(this.href);
				return false;
			});
		}

	);

	$('#container form input[@type=file]').each(
		function () {
			uploadForm = new Ajax_upload(this);
		}
	);
	

	$('#container form').each(function () {
		
		if (!$(this).attr('onsubmit')) {
			$(this).submit( function ( ) {PostForm(this); return false; } );
		}
	
	});

}

/**
 * Проверка используется ли на сайте флеш
 */
var checkFlashExists = function (need) {

	if (DetectFlashVer(need, 0, 0)) {
		return true;
	}
	else {
		return false;
	}
	
}