$(document).ready(function () {
	if ($('#title_replace')) {
		$("#title_holder").html($('#title_replace').html());
	} 
	
	if ($("#advertisements")) {
		//alert($("#advertisements").html());
		$("#advertisements_holder").html($("#advertisements").html());
	}
	
	jQuery.each($('img'), function() {
		if ($(this).attr('href')) {
			$(this).addClass('hover');
		}
	});
	
	$('button').click(function(e) {
		if ($(this).attr('href')) {
			//alert($(this).attr('href'));
			document.location=$(this).attr('href');
		} else if ($(this).attr('action')) {
			$("#action").val($(this).attr('action'));	
		}		
	});
	
	$('button.back').click(function(e) {
		if ($(this).attr('href')) document.location=$(this).attr('href');	
		else history.back();	
	});
	
	
	$('img, div, li').click(function(e) {
		if ($(this).attr('target')) {
			if ($(this).attr('target')=="_blank") window.open($(this).attr('href'));
		} else {
			//alert($(this).attr('href'));
			if ($(this).attr('href')) {
				document.location=$(this).attr('href');
			}
		}
	});

});

function select_option(name, value) {
	//alert($(name+" option").val());
	jQuery.each($(name+" option"), function() {
		
		if ($(this).val()==value) {
			//alert($(this).attr('val'));
			$(this).attr('selected', 'selected');
		}
	});
}