function showObject(obj_id){
	var obj = document.getElementById(obj_id);
	obj.style.display='block';
}

function hideObject(obj_id){
	var obj = document.getElementById(obj_id);
	obj.style.display='none';
}

function DelTextBoxContent(obj_id) {
	var obj = document.getElementById(obj_id);
	obj.value = '';
}

function SetAccountAddress(cur_obj,obj_id){
	if ( cur_obj.checked ) {
		hideObject(obj_id);
	} else {
		showObject(obj_id);
	}
}

//szoveg kijelolese:
function SelectText(obj_id) {
	var obj = document.getElementById(obj_id);
	obj.select();
}

//szoveg torlese:
function DeleteText(obj_id) {
	var obj = document.getElementById(obj_id);
	obj.value = "";
}

function CheckYearText(cur_obj,obj_id){
	var obj = document.getElementById(obj_id);
	//csak 2-essel kezdodhet:
	if ( cur_obj.value.length == 1 && cur_obj.value > 2 ){
		cur_obj.value = '';
	}

	//ha elerte a hossz a 4 karaktert, akkor ugras a honapok mezore:
	if ( cur_obj.value.length == 4 ) {
		obj.focus();
	}
}

function CheckMonthText(cur_obj,obj_id1,obj_id2){
	var obj1 = document.getElementById(obj_id1);
	var obj2 = document.getElementById(obj_id2);

	//ha az ev mezo meg ures, akkor nem lehet bele irni:
	if ( obj1.value.length == 0 ){
		cur_obj.value = '';
		obj1.focus();
	}

	//nem lehet naqyobb 12-nel:
	if ( cur_obj.value > 12 ){
		cur_obj.value = '';
	}
	
	//ha elerte a hossz a 2 karaktert, akkor ugras a nap mezore:
	if ( cur_obj.value.length == 2 ){
		obj2.focus();
	}
}

function CheckMonthText2(cur_obj) {
	if ( cur_obj.value >= 1 && cur_obj.value <= 9 && cur_obj.value.length == 1 ) {
		cur_obj.value = "0" + cur_obj.value;
	}

	if ( cur_obj.value < 1 ){
		cur_obj.value = '';
	}
}

function CheckDayText(cur_obj,obj_id1,obj_id2){
	var obj1 = document.getElementById(obj_id1); //honap
	var obj2 = document.getElementById(obj_id2); //ev

	//ha a honap mezo meg ures, akkor nem lehet bele irni:
	if ( obj1.value.length == 0 ){
		cur_obj.value = '';
		obj1.focus();
	}

	//napok ellenorzese:
	if ( obj1.value == "2" || obj1.value == "02" ) {
		//szokoev vagy nem:
		if ( obj2.value % 4 == 0 ){
			if ( cur_obj.value > 29 ){
				cur_obj.value = '';
			}
		} else {
			if ( cur_obj.value > 28 ){
				cur_obj.value = '';
			}
		}
	} else if ( obj1.value == "4" || obj1.value == "04" || obj1.value == "6" || obj1.value == "06" || obj1.value == "9" || obj1.value == "09" || obj1.value == "11" ) {
		if ( cur_obj.value > 30 ){
			cur_obj.value = '';
		}
	} else {
		if ( cur_obj.value > 31 ){
			cur_obj.value = '';
		}
	}
}

function CheckDayText2(cur_obj) {
	if ( cur_obj.value >= 1 && cur_obj.value <= 9 && cur_obj.value.length == 1 ) {
		cur_obj.value = "0" + cur_obj.value;
	}

	if ( cur_obj.value < 1 ){
		cur_obj.value = '';
		cur_obj.focus();
	}
}

function SetChecked(obj,value){
	obj.checked = value;
}

function scrollToCoordinates() {
	coord_y = Get_Cookie('scroll_y');
	window.scrollTo(0,coord_y);
}

function getScrollXY(cookie_type) {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	//return [ scrOfX, scrOfY ];
	//document.form_courses.scrolly.value = scrOfY;
	if ( cookie_type == '1' ){
		Set_Cookie("ex_scroll_y", scrOfY, 0, "/", "", 0);
	} else {
		Set_Cookie("scroll_y", scrOfY, 0, "/", "", 0);
	}
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

function SetPrice(cur_value,obj_id){
	var pos = cur_value.indexOf("_");
	var price = cur_value.substring(pos+1);
	var obj = document.getElementById(obj_id);
	obj.innerHTML = price;
}

function setBold(obj_id){
	if(document.getElementById) {
		document.getElementById(obj_id).style.color = "#000000";
	} else if(document.layers) {
		document.obj_id.style.color = "#000000";
	} else if(document.all) {
		document.all.obj_id.style.color = "#000000";
	}
}

function setNormal(obj_id){
	if(document.getElementById) {
		document.getElementById(obj_id).style.color = "#ffffff";
	} else if(document.layers) {
		document.obj_id.style.color = "#ffffff";
	} else if(document.all) {
		document.all.obj_id.style.color = "#ffffff";
	}
}

/*function SetLinkStyle(obj, obj_classname) {
	var theObj;
	
	if(document.all) {
		theObj = document.all(obj);
	} else if(document.getElementById) {
		theObj = document.getElementById(obj);
	}
	//alert("this");
	//alert(theObj);

	var m = theObj.children;
	if ( obj_classname == "even_course_selected" ) {
		for (i=0; i<m.length; i++){
			m.item(i).style.backgroundColor = "#D7D9F6";
		}
	} else {
		for (i=0; i<m.length; i++){
			m.item(i).style.backgroundColor = "#CDCEFC";
		}
	}
}

function SetLinkStyleBack(obj, obj_classname) {
	var theObj;
	if(document.all) {
		theObj = document.all(obj);
	} else if(document.getElementById) {
		theObj = document.getElementById(obj);
	}

	var m = theObj.children;
	if ( obj_classname == "even_course" ) {
		for (i=0; i<m.length; i++){
			m.item(i).style.backgroundColor = "#e9e9ec";
		}
	} else {
		for (i=0; i<m.length; i++){
			m.item(i).style.backgroundColor = "#ffffff";
		}
	}
}*/