$(document).ready(function(){

	// menus control
	$(".headerContainer ul:eq(0) li").hover(
		function() { $(".subMenus ul", $(this)).slideDown(500); },
		function() { $(".subMenus ul", $(this)).slideUp(100); }
	);
	// end menus control

	// right column control
	/*
	$(".slideContent:not(:eq(0))").slideUp();
	$(".slideContent:eq(0)").addClass("actived");
	$(".rightSlide h1:eq(0) img").attr("src",SITE_URL+"/_images/arrowdown_white.gif");
	$(".rightSlide h1").hover(function(elm) {
		if(!$(".slideContent", $(this).parent()).hasClass("actived")) {
			$(".rightSlide h1 img").attr("src",SITE_URL+"/_images/arrownext_white.gif");
			$("img", $(this)).attr("src",SITE_URL+"/_images/arrowdown_white.gif");
			$(".slideContent").removeClass("actived").slideUp();
			$(".slideContent", $(this).parent()).slideDown().addClass("actived");
		}
	});
	*/
	// end right column control

	// close notify error
	$(".close").click(
		function () {
			$(this).parent().fadeTo(400, 0, function () { // Links with the class "close" will close parent
				$(this).slideUp(400);
			});
			return false;
		}
	);

	// add red color for request field
	$('label:contains("*")').each(function(){$(this).html($(this).html().replace('*','<span>*</span>'));});
})

function PlayClip(imgvideo) {
	var so = new SWFObject(SITE_URL+"/_swf/player_flv_multi.swf?r=230841", "video", "238", "164", "6", "#000000");
	so.addVariable('flv',SITE_URL+'/flash/'+imgvideo+'.flv');
	so.addVariable('width','238');
	so.addVariable('height','164');
	so.addVariable('showiconplay','1');
	so.write("flashObject");
	return false;
}

// rounding function: n is number to round; p is precision
function JSround(n, p){return Math.round(n * Math.pow(10, p)) / Math.pow(10, p)}

//fill the contents of a form with test data
function fillFormTest(form){
	var choice = "1234567890abcdefghiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXTZ";
	var rndword; var rnd;
	for(i = 0; i < form.elements.length - 1; i++){
		rndword = '';
		for (var r = 0; r < Math.floor(Math.random() * 13) + 3; r++) {
		  rnd = Math.floor(Math.random() * choice.length);
		  rndword += choice.substring(rnd,rnd+1);
		}
		etype = form.elements[i].type;
		if(etype == 'text' || etype == 'textarea'){form.elements[i].value = rndword}
		if(etype == 'checkbox' || etype == 'radio'){form.elements[i].checked = true;}
	}
}

