try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

function binding() {
	$('#s').bind('click', function() {
		if ($(this).attr('value') == 'Keyword(s)') {
			$(this).attr('value', '');
		}
	});
	
	$('#s').bind('blur', function() {
		if ($(this).attr('value') == '') {
			$(this).attr('value', 'Keyword(s)');
		}
	});
	
	$('#corporatewebsite').bind('mouseover', function() {
													  $(this).attr('src', 'http://116.12.49.180/en/templates/ad_china/images/btn_corporatewebsite_over.gif');
													  });
	$('#corporatewebsite').bind('mouseout', function() {
													  $(this).attr('src', 'http://116.12.49.180/en/templates/ad_china/images/btn_corporatewebsite.gif');
													  });
	
	$('#home_worldwide_jumpmenu').bind('click', function() { $(this).css('width', '280px'); });
	$('#home_worldwide_jumpmenu').bind('blur', function() { $(this).css('width', '153px'); });
}

function css3() {
	target_1 = $('.moduletable_cornermenu ul li:last');
	target_1.css('border-right', 'none');
	target_1.css('padding-right', '0px');
	
	target_2 = $('.moduletable_topmenu ul li:first');
	target_2.attr('class', 'first');
	
	target_3 = $('#mainlevel_sidemenu li.mainlevel_current_sidemenu:has(ul)');
	target_3.css('background-image', 'url(http://116.12.49.180/en/templates/ad_china/images/nav_arrow_active.gif)');
	
	target_4 = $('#mainlevel_sidemenu li.mainlevel_active_sidemenu:has(ul)');
	target_4.css('background-image', 'url(http://116.12.49.180/en/templates/ad_china/images/nav_arrow_active.gif)');
	
	target_5 = $('#mainlevel_sidemenu li.mainlevel_active_sidemenu:has(ul) a.mainlevel_sidemenu');
	target_5.css('color', '#C00');
	
	target_6 = $('#mainlevel_bottommenu li:last a');
	target_6.css('border-right', 'none');
	
	target_7 = $('select[@name=limit]');
	target_7.wrap('<div id="limit" style="border-top: 1px solid #0CF; margin-top: 8px; padding-top: 8px; color: #0CF;"></div>');
	target_7.css('width', '60px');
	target_7.before('View no. of results per page: ');
	
	target_8 = $('.contentpaneopen td ul.splash_links li:last');
	target_8.css('margin-bottom', '0px');
	
	target_9 = $('.contentpaneopen td div.news_item:last');
	target_9.css('margin-bottom', '0px');
	
	//target_10 = $('#mainlevel_bottomsidemenu li.mainlevel_current_bottomsidemenu ul li:last a');
	//target_10.css('border-right', 'none');
	
	//target_11 = $('#mainlevel_bottomsidemenu li.mainlevel_active_bottomsidemenu ul li:last a');
	//target_11.css('border-right', 'none');
	
	$('#mainlevel_topmenu li:eq(5)').remove(); //hide About from topmenu
	$('#mainlevel_topmenu li:eq(5)').remove(); //hide Contact Us from topmenu
	
	$('#mainlevel_bottomsidemenu > li:eq(5)').remove(); //hide About from topmenu
	$('#mainlevel_bottomsidemenu > li:eq(5)').remove(); //hide Contact Us from topmenu
	
	target_10 = $('#mainlevel_bottomsidemenu > li:last a');
	target_10.css('border-right', 'none');
	
	target_11 = $('#mainlevel_bottomsidemenu li.mainlevel_active_bottomsidemenu:has(ul) a.mainlevel_bottomsidemenu');
	target_11.css('color', '#C00');
	
	target_12 = $('#joblisting tr:odd');
	target_12.css('background', '#F1F1F1');
	
	target_13 = $('a.readon');
	target_13.wrap('<div align="right" style="background: #EDEDED; padding: 5px 10px;"></div>');
	
	//target_14 = $('.normtable tr:odd');
	//target_14.css('background', '#F1F1F1');
}

function mainmenu() {
	$('.moduletable_topmenu ul li a').append('<img src="http://116.12.49.180/en/templates/ad_china/images/spacer.gif" class="cap" alt="" />');
	$('.moduletable_topmenu ul').append('<li><img src="http://116.12.49.180/en/templates/ad_china/images/spacer.gif" class="endCap" alt="" /></li>');
}

function MM_jumpMenu_window(targ,selObj,restore) {
	if (selObj.options[selObj.selectedIndex].value != 'nolink') {
		eval(targ+".open('"+selObj.options[selObj.selectedIndex].value+"')");
	}
	if (restore) selObj.selectedIndex=0;
}

function clearall() {
	fields = [
		'contact_worldwide_ap',
		'contact_worldwide_americas',
		'contact_worldwide_europe',
		'australia', 'bangladesh', 'china', 'hongkong', 'india', 'indonesia', 'japan', 'korea', 'malaysia', 'newzealand', 'philippines', 'singapore', 'srilanka', 'taiwan', 'thailand', 'vietnam', 'argentina', 'brazil', 'canada', 'chile', 'dominicanrepublic', 'elsalvador', 'guatemala', 'mexico', 'peru', 'spain', 'usa', 'austria', 'belgium', 'denmark', 'france', 'germany', 'hungary', 'ireland', 'italy', 'luxemborg', 'netherlands', 'poland', 'russia', 'southafrica', 'spain', 'sweden', 'switzerland', 'turkey', 'uk', 'uae'
		];
	
	jQuery.each(fields, function() {
					$('#' + this).css('display', 'none');
				});
}

function contact_region() {
	selected_region = $('#contact_worldwide_region').val();
	selected_ap = $('#contact_worldwide_ap').val();
	selected_americas = $('#contact_worldwide_americas').val();
	selected_europe = $('#contact_worldwide_europe').val();
	clearall();
	
	if (selected_region == '1') {
		$('#contact_worldwide_ap').css('display', 'block');
		$('#' + selected_ap).css('display', 'block');
	} else if (selected_region == '2') {
		$('#contact_worldwide_americas').css('display', 'block');
		$('#' + selected_americas).css('display', 'block');
	} else if (selected_region == '3') {
		$('#contact_worldwide_europe').css('display', 'block');
		$('#' + selected_europe).css('display', 'block');
	}
}

function random_img() {
	var img = new Array();

	img[0] = 'spot_corp1';
	img[1] = 'spot_corp2';
	img[2] = 'spot_corp3';
	
	var img_length = img.length;
	var selected_img = Math.round(Math.random()*(img_length-1));
	$('#spot').addClass(img[selected_img]);
}

function startup() {
	binding();
	css3();
	mainmenu();
	$('#logo_bg, #logo_bg_btm, #searchbtn, #spot_cover').ifixpng();
	random_img();
}