// JavaScript Document
jQuery.preloadImages = function() {
	for(var i = 0; i<arguments.length; i++) {
		jQuery("<img>").attr("src", arguments[i]);
	}
}

$(document).ready(function() {
	if ((document.documentElement.clientWidth) >= 937) {
		$("html").css({ "overflow-x": "hidden" });
	} else {
		$("html").css({ "overflow-x": "scroll" });
	};
	
	$(window).resize(function(){
		if ((document.documentElement.clientWidth) >= 937) {
			$("html").css({ "overflow-x": "hidden" });
		} else {
			$("html").css({ "overflow-x": "scroll" });
		} 
	});
	
	$('map').click(function() {
		this.blur();
	});
	
	/* embed flash */
	$('#flash').flash({
		src: '/fla/header.swf',
		width: 1137,
		height: 141,
		wmode: 'opaque',
		menu: 'false'
	});
	
	$('#flash_1').flash({
		src: '/fla/header1.swf',
		width: 889,
		height: 139,
		align: 'middle',
		salign: '',
		menu: 'false',
		allowfullscreen: 'false',
		allowscriptaccess: 'sameDomain',
		play: 'true',
		wmode: 'transparent',
		name: 'Header1',
		id: 'Header1',
		loop: 'true',
		movie: 'Header1'
	});
	/* /// embed flash */

	$.preloadImages("/images/loading.gif", "/images/btn_login_over.gif", "/images/empty.gif", "/images/btn_find_over.png", "/js/ogb/jcombobox/round.gif", "/js/ogb/jcombobox/round_hover.gif");
	$("#id_password").hide();
	$("#id_password_txt").show();
	
	$("#id_login").focus(function(){
		$("#id_login").attr({ value: "" });
	});
	
	$("#id_password_txt").focus(function(){
		$("#id_password_txt").toggle();
		$("#id_password").toggle();
		$("#id_password").focus();
	});
	
	// buttons mouseover
	$("#btn_login").mouseover(function(){
		$("#btn_login").attr({ src: "/images/btn_login_over.gif" });
	}).mouseout(function(){
		$("#btn_login").attr({ src: "/images/btn_login.gif" });
	});
	
	$("#btn_find").mouseover(function(){
		$("#btn_find").attr({ src: "/images/btn_find_over.png" });
	}).mouseout(function(){
		$("#btn_find").attr({ src: "/images/btn_find.png" });
	});
	
	$("#btn_post").mouseover(function(){
		$("#btn_post").attr({ src: "/images/btn_post_over.png" });
	}).mouseout(function(){
		$("#btn_post").attr({ src: "/images/btn_post.png" });
	});
	
	// combobox init
	if ( $(".cb").length > 0 ) {
		$('.cb').jcombox({theme: 'mytheme', set: true, fx: 'slideFade', fxDelay: 200 });
	}
	if ( $(".cb_1").length > 0 ) {
		$('.cb_1').jcombox({theme: 'mytheme', set: true, fx: 'slideFade', fxDelay: 200 });
	}
	if ( $(".cb_2").length > 0 ) {
		$('.cb_2').jcombox({theme: 'mytheme_1', set: true, fx: 'slideFade', fxDelay: 200 });
	}
	if ( $(".cb_3").length > 0 ) {
		$('.cb_3').jcombox({theme: 'mytheme_2', set: true, fx: 'slideFade', fxDelay: 200 });
	}
	// -----------------

	$('input[radio]:radio').checkbox({cls:'jquery-radio-checkbox'});
	$('input[radio]:radio').checkbox({cls:'jquery-radio-checkbox'}); 
	$('input[type=checkbox]').checkbox();	
	$('input[smallchk]:checkbox').checkbox({cls:'jquery-smallchk-checkbox'});
	
	if ( $("#s2").length > 0 ) {
		$('#s2').cycle({  fx: 'fade', speed:500, delay:100 })
	}
});
