﻿var etxt = ', szerintem ki fogja bírni. :)<br/>';

function INIT_JS()
{
	INIT_JS_HEAD();
	//
	var h = $('HIRLEVEL_MODUL');
	h.innerHTML = '<iframe src="http://hirlevel.mediacenter.hu/hirlevel_feliratkozas.php?betu_szin=fcfcfc&hatter_szin=017494&keret_szin=017494&lista_id=12611383427287&user_id=303&cimgyujto_id=115&str=p9%2BZ5LE%3D&form_type=1" style="width:200px;height:150px;overflow:hidden;border:solid 1px #C6CFD1" frameborder="0"></iframe>';
}

//default.aspx        --> start

function INIT_JS_DEFAULT()
{
	INIT_JS(); //baseform init
	//
	// load calendar with default month
	//
	//GET('Default.Get_Calendar_Month', 'CALENDAR_CALENDAR', '');
	//
	// load countries
	//
	loadCountriesDefault();
}
function RefreshCalendarDefault(cID)
{
	
	var countryID = 0;
	if (cID != 0) countryID = GET_DATAFIELD('country','ID') ;
	
	if (countryID[0] == 'c' || countryID == '')
	{
		countryID = 0;
	}
	var m = DDSV('dd_type');
	var t = DDSV('dd_month');
	var tt = t.split("_");
	var P = tt[0]+'|'+tt[1]+'|1|'+m+'|'+countryID;
	var P2 = 'calendar_'+tt[0]+'_'+tt[1]+'_1_'+m+'_'+countryID;
	
	//alert(P2);
	//GET('Default.Get_Content_FromCache','CALENDAR_CALENDAR', P2);
	//alert('hej');
	//GET('Default.Get_Calendar_Month', 'CALENDAR_CALENDAR', P);
	
}

function loadCountriesDefault()
{
	var typeID = DDSV('dd_type');
	var from  = DDSV('dd_month');
	var P = typeID+'|'+from;
	var P2 = 'calendarcountries_'+typeID+'_'+from;
	
	//alert('1:'+P2);
	
	GET('Default.Get_Content_FromCache','CALENDAR_SEARCH', P2);
	
	//GET('Default.Get_All_Route_Month', 'CALENDAR_SEARCH', P);
	HIGHLIGHT_SELECTED('country');
	
	loadDetailsDefault();
}
function loadCountriesNoLimitDefault()
{
	var typeID = DDSV('dd_type');
	var from  = DDSV('dd_month');
	var P = typeID+'|'+from;
	GET('Default.Get_All_Route_Month_NoLimit', 'CALENDAR_SEARCH', P);
	loadDetailsDefault();
}


function DEF2_C(controlName)
{
	var control = $ (controlName); control.checked = true; DEF_C(control);
}

function HIGHLIGHT_SELECTED(naming)
{
	RESET_LIST(naming);
	if ($('country0') != undefined)
	{
		GET_SELECTED_IMG(naming).border = '2';
		GET_SELECTED_DIV(naming).style['background-color'] = '#00ff00';
		GET_SELECTED_DIV(naming).style['border'] = '1px solid black';
		//
		RefreshCalendarDefault(-1); //selected country
	}
	else
	{
		RefreshCalendarDefault(0); //every country
	}
}

function DEF_C(cityRadio)
{
	nd();
	HIGHLIGHT_SELECTED('country');
	loadDetailsDefault();
}

function RESET_LIST(naming)
{
	var i = 0; 	var ACT = $ (naming+i);
	while (ACT != undefined)	
	{
		var ACTIMG = $ ('img_'+naming+i.toString());
		var ACTDIV = $ ('div_'+naming+i.toString());
		ACTIMG.border = '2';
		ACTDIV.style['background-color'] = 'transparent';
		ACTDIV.style['border'] = '0px solid black';

		i++; 	ACT = $(naming+i);					
	}
	return ACT;	
}


function DEFC2_C(controlName)
{
	var control = $ (controlName);
	control.checked = true;
	DEFC_C(control);
}
function DEFC_C(cityRadio)
{
	nd(); 
	var routeID = GET_DATAFIELD('route','ID') ;
	window.location = 'http://www.utazz.com/ShowRoute.aspx?id='+routeID;
}

function loadDetailsDefault()
{
	var typeID = DDSV('dd_type');
	var from  = DDSV('dd_month');
	var countryID = GET_DATAFIELD('country','ID') ;
	//
	//alert($('CALENDAR_THE_DISPLAY'));
	//alert($('CALENDAR_THE_DISPLAY').innerHTML);
	//alert($('SELECTED_MONTH').innerHTML + ' - ' + $('SELECTED_COUNTRY').innerHTML);
	$('CALENDAR_THE_DISPLAY').innerHTML = 'www.utazz.com&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+$('SELECTED_MONTH').innerHTML + ' - ' + $('SELECTED_COUNTRY').innerHTML+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;www.utazz.com';
	//alert($('CALENDAR_THE_DISPLAY').innerHTML);
	//
	if ( $('CALENDAR_DETAIL').style['display'] != 'none')
	{
		if (countryID[0] == 'c')
		{
			//alert('Nincs megjeleníthetõ utazás ezzel az utazási móddal, a hónapban.');
			$('CALENDAR_SEARCH').innerHTML = 'Nincsenek megjelenitheto orszagok';
		}
		else
		{
			var P = '2'+'|'+typeID+'|'+from +'|'+ countryID;
			//alert(P);
			var P2 = 'calendardetails_2_'+typeID+'_'+from+'_'+countryID;
			
			//alert(P2);
			GET('Default.Get_Content_FromCache','CALENDAR_DETAIL', P2);
			//alert('hej');
			//GET('Default.Get_Calendar_Month', 'CALENDAR_CALENDAR', P);
			
			//GET('Default.Get_All_Route_Month_Country', 'CALENDAR_DETAIL', P);
		}
	}
}

var pos=0;
var timerID = 0;
function Scroll() 
{
	obj=$('thetext');
	pos -=1;
	if (pos < 0-obj.offsetHeight+204) 
	{
		pos = 0;
	}
	if (obj.style.top == null) obj.style.top = '0px';
	obj.style.top=pos.toString()+'px';
	timerID = window.setTimeout("Scroll()",100);
}
function StopScroll()
{
	window.clearTimeout(timerID);
}
function DS(T){
if (typeof T.onselectstart!="undefined") 
	T.onselectstart=function(){return false}
else if (typeof T.style.MozUserSelect!="undefined") 
	T.style.MozUserSelect="none"
else 
	T.onmousedown=function(){return false}
T.style.cursor = "default"
}

//default.aspx        --> end


//ajandek.aspx        --> start

function SUBMIT_Ajandek(button)
{
	//collect data
	var ec = $ ('p_ajandekHiba');
	var text = '';
	var t1 = $ ('t_name');
	var t2 = $ ('t_email');
	var t3 = $ ('t_phone');
	var t4 = $ ('t_kinek');
	var dd0 = $ ('dd_price');
	var t5 = $ ('t_egyeb');
	var t6 = $ ('t_desc');
	
	
	var name = t1.value;
	var email = t2.value;
	var phone = t3.value;
	var kinek = t4.value;
	var priceID = DDSV('dd_price');
	var egyeb = t5.value;
	var desc = t6.value;
	
	
	if (name.length == 0)
	{
		text += 'Kérem adja meg nevét.'+unescape('%3Cbr%3E');
	}
	if (phone.length == 0)
	{
		text += 'Kérem adja meg telefonszámát.'+unescape('%3Cbr%3E');
	}
	if (kinek.length == 0)
	{
		text += 'Kérem adja meg a kedvezményezett nevét.'+unescape('%3Cbr%3E');
	}
	
	if (text.length == 0)
	{
		ec.innerHTML = 'Igénylés feldolgozása folyamatban...';
		
		
		var P = name+'|'+email+'|'+phone+'|'+kinek+'|'+priceID+'|'+egyeb+'|'+desc; 
		GET('Ajandek.FORM_POSTBACK', 'p_ajandek', P);
		

		
		text = '';
		t1.value = '';
		t2.value = '';
		t3.value = '';
		t4.value = '';
		dd0.selectedIndex = 0;
		t5.value = '';
		t6.value = '';
	}
	else
	{
		
		ec.innerHTML = text;
	}
}

function egyeb()
{
	var DD = $ ('dd_price');
	var C = $ ('p_egyeb');
	var T = $ ('t_egyeb');
		if (DD.options[DD.selectedIndex].value == '5')
		{
			C.style.visibility = 'visible';
			T.value = '';
		}
		else
		{
			C.style.visibility = 'hidden';
		}
}

//ajandek.aspx        --> end

//autoberles.aspx        --> start


function INIT_JS_AUTOBERLES()
{
	INIT_JS(); //baseform init
	InitFormAutoberles();
	loadCarTypes();
}
		
function InitFormAutoberles()
{
		var t1 = $ ('t_name');
		var t2 = $ ('t_email');
		var t3 = $ ('t_phone');
		var t4 = $ ('t_address');
		var t5 = $ ('t_desc');
		t1.value = '';
		t2.value = '';
		t3.value = '';
		t4.value = '';
		t5.value = '';
}
		
function loadCarTypes()
{
	var P = '';
	GET('AutoBerles.Get_All_CarType_DD', 'p_autoberlesTipusF', P);

	loadCars();
}
		
function loadCars()
{
	var ddT = $('dd_cartype');
	var typeID = ((ddT.selectedIndex == -1) ? (ddT.options[0].value) : (ddT.options[ddT.selectedIndex].value));
	var P = typeID;
	GET('AutoBerles.Get_Car_FilterType', 'p_autoberlesAutoF', P);
	//SelectDD('dd_honnan1',1); //magyarország
	loadCarDetails();
}
		
function AUT2_C(controlName)
{
	var control = $ (controlName);
	control.checked = true;
	AUT_C(control);
}
function AUT_C(cityRadio)
{
	loadCarDetails();
}

function loadCarDetails()
{
	var i = 0;
	var act_ctype = $ ('ca'+i)
	while (act_ctype != undefined)
	{
		if (act_ctype.checked == true)
		{
			break;
		}
		i++;
		act_ctype = $ ('ca'+i);
	}
	
	var carID = act_ctype.value;
	
	P = carID;
	GET('AutoBerles.Get_AutoBerles_DetailsPanel', 'p_autoberlesDetailsF', P);
	napotValt();
}
		
		function napotValt()		
		{
			var C = $('p_price');
			
			var mode = DDSV('dd_price');
			var C2 = $ ('ACT_DAY'+mode);
			C.innerHTML = '<strong style="font-size:17px">'+C2.innerHTML+'</strong>';
		}
		
		function SUBMIT_AutoBerles(button)
		{
			var ec = $ ('p_autoberlesHiba');
			var text = '';
			
			var i = 0;
			var act_ctype = $ ('ca'+i)
			while (act_ctype != undefined)
			{
				if (act_ctype.checked == true)
				{
					break;
				}
				i++;
				act_ctype = $('ca'+i);
			}
			
			var t1 = $('t_name');
			var t2 = $('t_email');
			var t3 = $('t_phone');
			var t4 = $('t_address');
			var t5 = $('t_desc');
			
			var carID = act_ctype.value;
			var ctypeID = DDSV('dd_cartype');
			var from1 = DDSV('dd_from1');
			var from2 = DDSV('dd_from2');
			var from3 = DDSV('dd_from3');
			var priceID  = DDSV('dd_price');
			var name = t1.value;
			var email = t2.value;
			var phone = t3.value;
			var address = t4.value;
			var desc = t5.value;
		
			
			
			if (name.length == 0)
			{
				text += 'Kérem adja meg nevét.<br/>';
			}
			if (name.indexOf('|') != -1)
			{
				text += 'Ne használjon | karaktert a névben'+etxt;
			}
			if (email.length == 0)
			{
				text += 'Kérem adja meg e-mail címét.<br/>';
			}
			if (email.indexOf('|') != -1)
			{
				text += 'Ne használjon | karaktert az emailben'+etxt;
			}
			if (phone.length == 0)
			{
				text += 'Kérem adja meg telefonszámát.<br/>';
			}
			if (phone.indexOf('|') != -1)
			{
				text += 'Ne használjon | karaktert a telefonszámban'+etxt;
			}
			if (address.length == 0)
			{
				text += 'Kérem adja meg címét.<br/>';
			}
			if (address.indexOf('|') != -1)
			{
				text += 'Ne használjon | karaktert a címben'+etxt;
			}
			
			if (text.length == 0)
			{
				ec.innerHTML = 'Igénylés feldolgozása folyamatban...';
				
				
				var P = ctypeID+'|'+carID+'|'+from1+'|'+from2+'|'+from3+'|'+priceID+'|'+name+'|'+email+'|'+phone+'|'+address+'|'+desc;
				
				GET('AutoBerles.FORM_POSTBACK', 'p_autoberles', P);
				ec.innerHTML += P;
				
				InitFormAutoberles();
			}
			else
			{
				
				ec.innerHTML = text;
			}
		}
		
		
		
//autoberles.aspx        --> end

//audioguide.aspx        --> start


		function SUBMIT_Audio(button)
		{
			if ($('confirmed').checked!=true)
			{
				alert("Kérem elõbb fogadja el a szerzõdési feltételeket!");
			}
			else
			{
				//alert (($('confirmed').checked==true));
				//collect data
				var ec = $('p_callcenterHiba');
				var text = '';
				var t1 = $('t_name');
				var t2 = $('t_email');
				var t3 = $('t_phone');
				var s1 = $('lblPriceEUR');
				var s2 = $('lblPriceHUF');
				var t4 = $('t_bill1');
				var t5 = $('t_bill2');
				var t6 = $('t_bill3');
				var t7 = $('t_address');
				var t8 = $('t_address2');
				
				var NAME = t1.value;
				var EMAIL = t2.value;
				var PHONE = t3.value;
				var COUNT = DDSV('dd_count');
				var HOUR = DDSV('dd_hour');
				var RANGE = DDSV('dd_range');
				var DATE = GET_DATE('CALLBACK_DATE');
				var PRICE_EUR = s1.innerHTML;
				var PRICE_HUF = s2.innerHTML;
				var PRICE_MODE = DDSV('dd_mode');
				var BILL1 = t4.value;
				var BILL2 = t5.value;
				var BILL3 = t6.value;
				var ADDRESS = t7.value;
				var ADDRESS2 = t8.value;
				
				
				var TIME = DDSV('dd_hour')+':00:00';
				
				if (NAME.length == 0){text += 'Kérem adja meg nevét.<br/>';}
				if (PHONE.length == 0){text += 'Kérem adja meg telefonszámát.<br/>';}
				if (EMAIL.length == 0){text += 'Kérem adja meg email címét.<br/>';}
				if (BILL1.length == 0){text += 'Kérem adja meg a számlázási nevet.<br/>';}
				if (BILL2.length == 0){text += 'Kérem adja meg a számlázási címet.<br/>';}
				if (BILL3.length == 0){text += 'Kérem adja meg adószámát.<br/>';}
				if (ADDRESS.length == 0){text += 'Kérem adja meg a kiszállítási címet.<br/>';}
				if (ADDRESS2.length == 0){text += 'Kérem adja meg a visszaszállítási címet.<br/>';}
				
				var d=new Date(); 			var day=d.getDate();			var month=d.getMonth() + 1;			var year=d.getFullYear();
				if (month.toString().length == 1) {month = '0'+month.toString();}
				if (day.toString().length == 1) {day= '0'+day.toString();}
				if ( DATE < (year+ "." + month + "." + day) )
				{	//alert(DATE+'|'+(year+ "." + month + "." + day));
						text += 'A kiválasztott nap nem megfelelõ.<br/>';
				}
				
				
				if (text.length == 0)
				{
					ec.innerHTML = 'Igénylés feldolgozása folyamatban...';
					
					var P = NAME+'|'+EMAIL+'|'+PHONE+'|'+DATE+'|'+TIME+'|'+COUNT+'|'+RANGE+'|'+PRICE_EUR+'|'+PRICE_HUF+'|'+PRICE_MODE+'|'+BILL1+'|'+BILL2+'|'+BILL3+'|'+ADDRESS+'|'+ADDRESS2; 
					//alert(P);
					GET('AudioGuide.FORM_POSTBACK', 'p_callcenter', P);
					text = '';
					t1.value = '';
					t2.value = '';
					t3.value = '';
					t4.value = '';
					t5.value = '';
					t6.value = '';
					t7.value = '';
					t8.value = '';
				}
				else
				{
					ec.innerHTML = text;
				}
			}
		}


//audioguide.aspx        --> end



//callcenter.aspx        --> start


		function SUBMIT_CallCenter(button)
		{
			//collect data
			var ec = $ ('p_callcenterHiba');
			var text = '';
			var t1 = $ ('t_name');
			var t2 = $ ('t_phone');
			var t3 = $ ('t_desc');
			
			
			var NAME = t1.value;
			var DATE = GET_DATE('CALLBACK_DATE');
			var TIME = DDSV('dd_hour')+':'+DDSV('dd_minute')+':00';
			var PHONE = '06-'+DDSV('dd_phone')+'-'+t2.value;
			var DESC = t3.value;
			
			
			if (NAME.length == 0)
			{
				text += 'Kérem adja meg nevét.<br/>';
			}
			
			if (t2.value.length == 0)
			{
				text += 'Kérem adja meg telefonszámát.<br/>';
			}
			else
			{
				if (NOT_NUM(t2.value))
				{
					text += 'A telefonszám kizárólag számokat tartalmazhat.<br/>';
				}
				else
				{
					if (t2.value.length != 6 && t2.value.length != 7)
					{
						text += 'A telefonszám 6 vagy 7 jegyû kell, hogy legyen.<br/>';
					}
				}
			}
			
			var d=new Date(); 			var day=d.getDate();			var month=d.getMonth() + 1;			var year=d.getFullYear();
			if (month.toString().length == 1) {month = '0'+month.toString();}
			if (day.toString().length == 1) {day= '0'+day.toString();}
			if ( DATE < (year+ "." + month + "." + day) )
			{	//alert(DATE+'|'+(year+ "." + month + "." + day));
					text += 'A kiválasztott nap nem megfelelõ.<br/>';
			}
			
			
			
			if (text.length == 0)
			{
				ec.innerHTML = 'Igénylés feldolgozása folyamatban...';
				
				var P = NAME+'|'+DATE+'|'+TIME+'|'+PHONE+'|'+DESC; 
				GET('CallCenter.FORM_POSTBACK', 'p_callcenter', P);
				
				text = '';
				t1.value = '';
				t2.value = '';
				t3.value = '';
			}
			else
			{
				
				ec.innerHTML = text;
			}
		}


//callcenter.aspx        --> end

//documents.aspx        --> start

function ChangePage(pic)
{
	$('PICTURE').src = 'pic/prosi/2008/'+pic;
}
function NextPicture()
{
	var dd = $('ddPages');
	dd.selectedIndex = (( dd.selectedIndex == dd.options.length-1 ) ? ( 0 ) : ( dd.selectedIndex+1 ));
	ChangePage(dd.options[dd.selectedIndex].value);
}
function PrevPicture()
{
	var dd = $('ddPages');
	dd.selectedIndex = (( dd.selectedIndex == 0 ) ? ( dd.options.length-1 ) : ( dd.selectedIndex-1 ));
	ChangePage(dd.options[dd.selectedIndex].value);
}

//documents.aspx        --> end

//hazhoz.aspx        --> start

function SUBMIT_Hazhoz(button)
{
	//collect data
	var ec = $ ('p_hazhozHiba');
	var text = '';
	var t0 = $ ('t_name');
	var t1 = $ ('t_address');
	var t2 = $ ('t_phone');
	var t3 = $ ('t_desc');
	
	
	var NAME = t0.value;
	var ADDRESS = t1.value;
	var DATE = GET_DATE('HAZHOZ_DATE');
	var TIME = DDSV('dd_hour')+':'+DDSV('dd_minute')+':00';
	var PHONE = '06-'+DDSV('dd_phone')+'-'+t2.value;
	var DESC = t3.value;
	
	
	if (NAME.length == 0)
	{
		text += 'Kérem adja meg nevét.<br/>';
	}
	if (ADDRESS.length == 0)
	{
		text += 'Kérem adja meg címét.<br/>';
	}
	
	if (t2.value.length == 0)
	{
		text += 'Kérem adja meg telefonszámát.<br/>';
	}
	else
	{
		if (NOT_NUM(t2.value))
		{
			text += 'A telefonszám kizárólag számokat tartalmazhat.<br/>';
		}
		else
		{
			if (t2.value.length != 6 && t2.value.length != 7)
			{
				text += 'A telefonszám 6 vagy 7 jegyû kell, hogy legyen.<br/>';
			}
		}
	}
	
	var d=new Date(); 			var day=d.getDate();			var month=d.getMonth() + 1;			var year=d.getFullYear();
	if (month.toString().length == 1) {month = '0'+month.toString();}
	if (day.toString().length == 1) {day= '0'+day.toString();}
	if ( DATE < (year+ "." + month + "." + day) )
	{	
			text += 'A kiválasztott nap nem megfelelõ.<br/>';
	}
	
	if (text.length == 0)
	{
		ec.innerHTML = 'Igénylés feldolgozása folyamatban...';
		
		var P = NAME+'|'+ADDRESS+'|'+DATE+'|'+TIME+'|'+PHONE+'|'+DESC; 
		GET('Hazhoz.FORM_POSTBACK', 'p_hazhoz', P);
		
		text = '';
		t0.value = '';
		t1.value = '';
		t2.value = '';
		t3.value = '';
	}
	else
	{
		
		ec.innerHTML = text;
	}
}

//hazhoz.aspx        --> end


//repjegy.aspx        --> start

function INIT_JS_REPJEGY() {

	INIT_JS(); //baseform init
    InitFormRepjegy();
    updateCount();
    loadCountry1();
    loadCountry2();
}
function InitFormRepjegy() {
    
    var t1 = $('t_name');
    var t2 = $('t_email');
    var t3 = $('t_phone');
    var t4 = $('t_desc');
    t1.value = '';
    t2.value = '';
    t3.value = '';
    t4.value = '';
}
function loadCountry1() {
    var P = 'dd_honnan1';
    GET('Repjegy.Get_Countries_WithAirport_DD', 'p_repjegyOrszagF', P);
    SelectDD('dd_honnan1', 1); //magyarország
    repjegyOrszagokF();
}
function loadCountry2() {
    var P = 'dd_hova1';
    GET('Repjegy.Get_Countries_WithAirport_DD', 'p_repjegyOrszagT', P);
    repjegyOrszagokT();
}
function SelectDD(controlName, KEY) {
    var DD = $(controlName);
    for (i = 0; i < DD.options.length; i++) {
        if (DD.options[i].value == KEY) {
            DD.options[i].selected = true;
            break;
        }
    }
}
function repjegyOrszagokF() {
    var countryID = DDSV('dd_honnan1');
    var P = 'dd_honnan2' + '|' + countryID;
    GET('Repjegy.Get_Cities_WithAirport_DD', 'p_repjegyVarosF', P);
    repjegyVarosokF();
}
function repjegyVarosokF() {
    //do nothing
}
function repjegyOrszagokT() {
    var countryID = DDSV('dd_hova1');
    var P = 'dd_hova2' + '|' + countryID;
    GET('Repjegy.Get_Cities_WithAirport_DD', 'p_repjegyVarosT', P);
    repjegyVarosokT();
}
function repjegyVarosokT() {
    //do nothing
}

function updateCount() {
    var t = $('countSum');
    var count1 = DDSV('dd_count1');
    var count2 = DDSV('dd_count2');
    var count3 = DDSV('dd_count3');

    t.innerHTML = '&nbsp;<big>' + (parseInt(count1) + parseInt(count2) + parseInt(count3)) + '</big>&nbsp;';
}

function SUBMIT_Repjegy(button) {
    var ec = $('p_repjegyHiba');
    var text = '';
    //
    var t1 = $('t_name');
    var t2 = $('t_email');
    var t3 = $('t_phone');
    var t4 = $('t_desc');
    //
    var name = t1.value;
    var email = t2.value;
    var phone = t3.value;
    var count1 = DDSV('dd_count1'); 
    var count2 = DDSV('dd_count2');
    var count3 = DDSV('dd_count3');
    var dirID = DDSV('dd_dir');
    var honnan1 = DDSV('dd_honnan1');
    var honnan2 = DDSV('dd_honnan2');
    var hova1 = DDSV('dd_hova1');
    var hova2 = DDSV('dd_hova2');
    var air = DDSV('dd_airagency');
    var clas = DDSV('dd_class');
    var from1 = DDSV('dd_from1');
    var from2 = DDSV('dd_from2');
    var from3 = DDSV('dd_from3');
    var to1 = DDSV('dd_to1');
    var to2 = DDSV('dd_to2');
    var to3 = DDSV('dd_to3');
    var desc = t4.value;
    
    if (name.length == 0) { text += 'Kérem adja meg nevét.<br/>'; }
    if (name.indexOf('|') != -1) { text += 'Ne használjon | karaktert a névben'+etxt;}
    if (email.length == 0) { text += 'Kérem adja meg e-mail címét.<br/>'; }
    if (email.indexOf('|') != -1) { text += 'Ne használjon | karaktert az emailben'+etxt;}
    if (phone.length == 0) { text += 'Kérem adja meg telefonszámát.<br/>'; }
    if (phone.indexOf('|') != -1) { text += 'Ne használjon | karaktert a telefonszámban'+etxt; }

    if (text.length == 0) {
        //ec.innerHTML = 'Igénylés feldolgozása folyamatban...';
        
        var P = name + '|' + email + '|' + phone + '|' + count1 + '|' + count2 + '|' + count3 + '|' + dirID + '|';
        P += honnan1 + '|' + honnan2 + '|' + hova1 + '|' + hova2 + '|' + air + '|' + clas + '|';
        P += from1 + '|' + from2 + '|' + from3 + '|' + to1 + '|' + to2 + '|' + to3 + '|' + desc;

        GET('Repjegy.FORM_POSTBACK', 'p_repjegy', P);
        InitFormRepjegy();
    }
    else {
        ec.innerHTML = text;
    }
}

//repjegy.aspx        --> end

//searchhotel.aspx        --> start

function INIT_JS_SEARCHHOTEL() {
	INIT_JS(); //baseform init
    loadTypesSearchHotel();
}
function loadTypesSearchHotel() {
    var P = '';
    GET('SearchHotel.Get_HotelType_DD', 'p_type', P);
    loadCGroupsSearchHotel();
}
function loadCGroupsSearchHotel() {
    var P = DDSV('dd_hoteltype'); GET('SearchHotel.Get_Hotel_CGroups_DD', 'p_group', P);
    loadCountriesSearchHotel();
}
function loadCountriesSearchHotel() {
    var P = DDSV('dd_hoteltype') + '|' + DDSV('dd_group'); GET('SearchHotel.Get_Hotel_Countries2_DD', 'p_country', P);
    loadCitiesSearchHotel();
}
function loadCitiesSearchHotel() {
    var P = DDSV('dd_hoteltype') + '|' + DDSV('dd_country'); /*alert(P);*/GET('SearchHotel.Get_Hotel_Cities_DD', 'p_city', P);
    DoSearchSearchHotel();
}
function DoSearchSearchHotel() {
    var columns = '4';
    var typeID = DDSV('dd_hoteltype');
    var cityID = DDSV('dd_city');
    var priceID = DDSV('dd_price');
    var start = ' ';
    var keyword = '';
    var top = DDSV('dd_resultcount');

    var P = columns + '|' + typeID + '|' + cityID + '|' + priceID + '|' + start + '|' + keyword + '|' + top;
    GET('SearchHotel.Get_HotelSearch', 'RESULTS', P);
}


function ROUTE2_C(controlName) {
    var control = $(controlName);
    control.checked = true;
    ROUTE_C(control);
}
function RE_C(restaurantRadio) {
    s2_ROUTE();
}
function s2_ROUTE() {
    var ACT = GET_SELECTED('re_')
    var hotelID = ACT.value;

    window.location = "ShowHotel.aspx?id=" + hotelID;
}

//searchhotel.aspx        --> end

//searchroute.aspx        --> start

function INIT_JS_SEARCHROUTE()
{
	INIT_JS(); //baseform init
	loadTypesSearchRoute();
}
function loadTypesSearchRoute()
{
	//HtmlControlUpdate('SearchRoute.Get_RouteType_DD', 'p_type', '');  //SPEED UP!
	loadCGroupsSearchRoute();
}
function loadCGroupsSearchRoute()
{
	var P=DDSV('dd_traveltype'); 
	
	GetClientGroupsSearchRoute(P);
	//SPEED UP!
	//alert(P);
	//GET('SearchRoute.Get_Route_CGroups_DD','p_group',P);
	//var DD = $('dd_group'); //if (DD.options.length == 1) {alert('1 van');}
	loadCountriesSearchRoute();
}

function GetClientGroupsSearchRoute(id)
{
	var DD = $('dd_group');
	for (i = 0; i < DD.options.length; i++)  {    DD.options[i] = null; }
	
	switch (parseInt(id,0))		{
	case 0: 		
	{
		DD.options[0] = new Option('(4033 db) Európa','2');
		DD.options[1] = new Option('(1113 db) Ázsia','5');
		DD.options[2] = new Option('(1042 db) Afrika','4');
		DD.options[3] = new Option('(336 db) Amerika','3');
		DD.options[4] = new Option('(29 db) Ausztrália','6');
	}	break;
	case 1: 		
	{
		DD.options[0] = new Option('(1150 db) Európa','2');
		DD.options[1] = new Option('(19 db) Ázsia','5');
		DD.options[2] = new Option('(18 db) Afrika','4');
		DD.options[3] = new Option('(15 db) Amerika','3');
		DD.options[4] = new Option('(12 db) Ausztrália','6');
	}	break;
	case 2: 		
	{
		DD.options[0] = new Option('(871 db) Európa','2');
		DD.options[1] = new Option('(5 db) Ázsia','5');
	}	break;
	case 3: 		
	{
		DD.options[0] = new Option('(2003 db) Európa','2');
		DD.options[1] = new Option('(1093 db) Ázsia','5');
		DD.options[2] = new Option('(1018 db) Afrika','4');
		DD.options[3] = new Option('(315 db) Amerika','3');
		DD.options[4] = new Option('(17 db) Ausztrália','6');
	}	break;
	case 4: 		
	{
		DD.options[0] = new Option('(9 db) Európa','2');
		DD.options[1] = new Option('(5 db) Afrika','4');
		DD.options[2] = new Option('(3 db) Amerika','3');
	}	break;
	default:				{					alert('unsupported traveltype init code: '+id);					}		
		break;				}//endswitch
		
		//select first item after creation
		DD.selectedIndex = 0;
}

function loadCountriesSearchRoute()
{
	var P=DDSV('dd_traveltype')+'|'+DDSV('dd_group');  GET('SearchRoute.Get_Route_Countries2_DD','p_country',P);
	loadCitiesSearchRoute();
}
function loadCitiesSearchRoute()
{
	var P=DDSV('dd_traveltype')+'|'+DDSV('dd_country'); /*alert(P);*/ GET('SearchRoute.Get_Route_Cities_DD','p_city',P);
	DoSearchSearchRoute();
}
function DoSearchSearchRoute()
{
	var columns = '4'; 
	var typeID = DDSV('dd_traveltype'); 
	var cityID = DDSV('dd_city');
	var priceID = DDSV('dd_price');
	var start = ' ';
	var keyword = '';
	var top = DDSV('dd_resultcount');
	
	var P = columns+'|'+typeID+'|'+cityID+'|'+priceID+'|'+start+'|'+keyword+'|'+top;
	GET('SearchRoute.Get_RouteSearch', 'RESULTS',P);
}


function RE2_C(controlName)
{
	var control = $ (controlName);
	control.checked = true;
	RE_C(control);
}
function RE_C(restaurantRadio)
{
	s2_RE();
}
function s2_RE()
{
	var ACT = GET_SELECTED('re_')
	var hotelID =  ACT.value;
	
	window.location = "ShowRoute.aspx?id="+hotelID;
}

//searchroute.aspx        --> end

//szallas.aspx			  --> start



function INIT_JS_SZALLAS() {
	INIT_JS(); //baseform init
    InitFormSzallas();
    updateCountSzallas();
    loadTypesSzallas();
}
function loadTypesSzallas() {
    var P = '';
    GET('Szallas.Get_HotelType_DD', 'p_szallasTipusF', P);
    loadCountry1Szallas();
}

function InitFormSzallas() {
    var t1 = $('t_name');
    var t2 = $('t_email');
    var t3 = $('t_phone');
    var t4 = $('t_desc');
    t1.value = '';
    t2.value = '';
    t3.value = '';
    t4.value = '';
}

function modeChangeSzallas() {
    var ID = DDSV('dd_mode');

    var C = $('p_megj');
    var C2 = $('p_megj2');
    if (ID != 1) {
        if (ID == 2) {
            //német
            C.src = "http://www.interhome.at/buchung/main.asp?partnerid=100198&so=10&userlang=04&ihnav=N";
        }
        else {
            //angol
            C.src = "http://www.interhome.at/buchung/main.asp?partnerid=100198&so=10&userlang=03&ihnav=N";
        }
        SHOW('p_megj');
        SHOW('p_megj2');
    }
    else {
		HIDE('p_megj');
        HIDE('p_megj2');
    }
}

function loadCountry1Szallas() {
    var typeID = DDSV('dd_hoteltype');
    var P = typeID;
    GET('Szallas.Get_Hotel_Countries_FilterType_DD', 'p_szallasOrszagF', P);
    //SelectDD('dd_honnan1',1); //magyarország
    szallasOrszagokFSzallas();
}

function szallasOrszagokFSzallas() {
    var typeID = DDSV('dd_hoteltype');
    var countryID = DDSV('dd_honnan1');
    var P = typeID + '|' + countryID;
    GET('Szallas.Get_Hotel_Cities_FilterType_DD', 'p_szallasVarosF', P);
    szallasVarosokFSzallas();
}
function szallasVarosokFSzallas() {
    var typeID = DDSV('dd_hoteltype');
    var countryID = DDSV('dd_honnan1');
    var cityID = DDSV('dd_honnan2');
    var P = typeID + '|' + countryID + '|' + cityID;
    GET('Szallas.Get_Hotel_Items_FilterType_DD', 'p_szallasHotelF', P);
    szallasHotelekFSzallas();
}

function szallasHotelekFSzallas()
{
    var P = DDSV('dd_honnan3');
    GET('Szallas.Get_Search_MiniPanel', 'p_szallasH', P);
}

function updateCountSzallas() {
    var t = $('countSum');
    var count1 = DDSV('dd_count1');
    var count2 = DDSV('dd_count2');
    var count3 = DDSV('dd_count3');
    t.innerHTML = '&nbsp;<big>' + (parseInt(count1) + parseInt(count2) + parseInt(count3)) + '</big>&nbsp;';
}

function SUBMIT_Szallas(button) {
    var ec = $('p_szallasHiba');
    var text = '';
    //
    var t1 = $('t_name');
    var t2 = $('t_email');
    var t3 = $('t_phone');
    var t4 = $('t_desc');
    //
    var name = t1.value;
    var email = t2.value;
    var phone = t3.value;
    var desc = t4.value;
    var modeID = DDSV('dd_mode');
    var htype = DDSV('dd_hoteltype');
    var honnan1 = DDSV('dd_honnan1');
    var honnan2 = DDSV('dd_honnan2');
    var honnan3 = DDSV('dd_honnan3');
    var count1 = DDSV('dd_count1'); 
    var count2 = DDSV('dd_count2');
    var count3 = DDSV('dd_count3');
    var from1 = DDSV('dd_from1'); 
    var from2 = DDSV('dd_from2'); 
    var from3 = DDSV('dd_from3'); 
    var to1 = DDSV('dd_to1'); 
    var to2 = DDSV('dd_t12'); 
    //
    if (name.length == 0) { text += 'Kérem adja meg nevét.<br/>';}
    if (name.indexOf('|') != -1) {text += 'Ne használjon | karaktert a névben'+etxt;}
    if (email.length == 0) {text += 'Kérem adja meg e-mail címét.<br/>';}
    if (email.indexOf('|') != -1) {text += 'Ne használjon | karaktert az emailben'+etxt;}
    if (phone.length == 0) {text += 'Kérem adja meg telefonszámát.<br/>';}
    if (phone.indexOf('|') != -1) {text += 'Ne használjon | karaktert a telefonszámban'+etxt;}

    if (text.length == 0) {
        ec.innerHTML = 'Igénylés feldolgozása folyamatban...';
        //
        var P = modeID + '|' + htype + '|' + honnan1 + '|' + honnan2 + '|' + honnan3 + '|' + count1 + '|' + count2 + '|' + count3 + '|';
        P += from1 + '|' + from2 + '|' + from3 + '|' + to1 + '|' + to2 + '|' + name + '|' + email + '|' + phone + '|' + desc;
        //
        GET('Szallas.FORM_POSTBACK', 'p_szallas', P);
        InitFormSzallas();
    }
    else { ec.innerHTML = text; }
}

//szallas.aspx			  --> end

//transzfer.aspx		  --> start

function SUBMIT_Transzfer(button)
{
	var ec = $ ('p_transzferHiba');
	var text = '';
	//
	var t1 = $ ('t_name');
	var t2 = $ ('t_email');
	var t3 = $ ('t_phone');
	var t4 = $ ('t_address');
	var t5 = $ ('t_flight');
	var t6 = $ ('t_desc');
	//
	var name = t1.value;
	var email = t2.value;
	var phone = t3.value;
	var address = t4.value;
	var flight = t5.value;
	var desc = t6.value;
	var dirID = DDSV('dd_dir');
	var airportID = DDSV('dd_airport');
	var count = DDSV('dd_count');
	//
	if (name.length == 0){text += 'Kérem adja meg nevét.<br/>';}
	if (phone.length == 0){text += 'Kérem adja meg telefonszámát.<br/>';}
	if (address.length == 0){text += 'Kérem adja meg honnan indulna.<br/>';}
	if (flight.length == 0){text += 'Kérem adja meg a járat számát.<br/>';}
	
	if (text.length == 0)
	{
		ec.innerHTML = 'Igénylés feldolgozása folyamatban...';
		//
		var P = name+'|'+email+'|'+phone+'|'+address+'|'+dirID+'|'+airportID+'|'+flight+'|'+count+'|'+desc; 
		GET('Transzfer.FORM_POSTBACK', 'p_transzfer', P);
		//
		text = '';
		t1.value = '';
		t2.value = '';
		t3.value = '';
		t4.value = '';
		t5.value = '';
		t6.value = '';
	}
	else {ec.innerHTML = text; }
}

//transzfer.aspx		  --> end

//ugyintezes.aspx		  --> start

function iranyito(zip) {
	var P = $('txt_zip').value;
    GET('Ugyintezes.Get_OTP', 'result', P);
}

//ugyintezes.aspx		  --> end

//utitars.aspx			  --> start

function INIT_JS_UTITARS() {
    InitFormUtitars();
    loadCountry2Utitars();
}
function InitFormUtitars() {
    
    var t1 = $('t_name');
    var t2 = $('t_email');
    var t3 = $('t_phone');
    var t4 = $('t_desc');
    t1.value = '';
    t2.value = '';
    t3.value = '';
    t4.value = '';
}
function loadCountry2Utitars() {
    var P = 'dd_hova1';
    GET('Utitars.Get_Countries_Utitars_DD', 'p_UtitarsOrszagT', P);
    UtitarsOrszagokT();
}

function UtitarsOrszagokT() {
    var countryID = DDSV('dd_hova1');
    var P = 'dd_hova2' + '|' + countryID;
    GET('Utitars.Get_Cities_Utitars_DD', 'p_UtitarsVarosT', P);
    UtitarsVarosokT();
}
function UtitarsVarosokT() {
    //do nothing
}
function SUBMIT_Utitars(button) {
    var ec = $('p_UtitarsHiba');
    var text = '';
    //
    var t1 = $('t_name');
    var t2 = $('t_email');
    var t3 = $('t_phone');
    var t4 = $('t_title');
    var t5 = $('t_desc');
    //
    var name = t1.value;
    var email = t2.value;
    var phone = t3.value;
    var title = t4.value;
    var desc = t5.value;
    var hova1 = DDSV('dd_hova1');
    var hova2 = DDSV('dd_hova2');
    //
    if (name.length == 0) {text += 'Kérem adja meg nevét.<br/>';}
    if (name.indexOf('|') != -1) {text += 'Ne használjon | karaktert a névben'+etxt;}
    if (email.indexOf('|') != -1) {text += 'Ne használjon | karaktert az emailben'+etxt;}
    if (phone.indexOf('|') != -1) {text += 'Ne használjon | karaktert a telefonszámban'+etxt;}
    if (title.length == 0) {text += 'Kérem adja meg a hirdetés címét.<br/>';}
    if (title.indexOf('|') != -1) {text += 'Ne használjon | karaktert a hirdetés címében'+etxt;}
    if (desc.length == 0) {text += 'Kérem adja meg a hirdetés tartalmát.<br/>';}
    if (desc.indexOf('|') != -1) {text += 'Ne használjon | karaktert a hirdetés szövegében'+etxt;}

    if (text.length == 0) {
        var P = name + '|' + email + '|' + phone + '|' + title + '|' + desc + '|' + hova1 + '|' + hova2;
        GET('Utitars.FORM_POSTBACK', 'p_Utitars', P);
        InitFormUtitars();
    }
    else {ec.innerHTML = text;}
}

//utitars.aspx			  --> end

//NEW_HEAD_ASCX			  --> start

function INIT_JS_HEAD() 
{
	var ie = false;
	var ff = false;
	if (document.getElementById) 
	{ 
		ff = true;
	} 
	if (document.all) 
	{ 
		ff = false;
		ie = true;
	} 
	InitHead(ff,ie);
}

function SHOW_B1(i)
{
	var c0 = 'CHead_HEAD_SEARCH';
	var c1 = 'CHead_HEAD_UTITARS';
	var c2 = 'CHead_HEAD_LASTMINUTE';
	
	switch (i)		
	{
		case 0: 	{ SHOW(c0);HIDE(c1);HIDE(c2); }  break;
		case 1: 	{ HIDE(c0);SHOW(c1);HIDE(c2); }  break;
		case 2: 	{ HIDE(c0);HIDE(c1);SHOW(c2); }  break;
		default:	{/*do nothing*/}break;				
	}//endswitch

}


function InitHead(ff,ie)
{
	//f1();	
	//
	//  load cached initial content instead
	//
	var c0 = 'CHead_HEAD_SEARCH';
	var c1 = 'CHead_HEAD_UTITARS';
	var c2 = 'CHead_HEAD_LASTMINUTE';
	//alert(1);
	/*
	if ($(c0) == null) { GET('C_NewHead.Get_Search_MiniPanel_FromCache',c0,'0'); }
	if ($(c1) == null) { GET('C_NewHead.Get_Search_MiniPanel_FromCache',c1,'1'); }
	if ($(c2) == null) { GET('C_NewHead.Get_Search_MiniPanel_FromCache',c2,'2'); }
	*/
	//alert(2);
}

	function f1()
	{
		var P = '2';
		GET('C_NewHead.Get_SearchType', 'p_mit', P);
		
		f2();
	}
	function f2_C(cN)
	{
		var c = $ (cN);
		c.checked = true;
		f2();	
	}
	function f2()
	{
		var i = 0;
		var act = $ ('mit'+i)
		while (act != undefined)
		{
			if (act.checked == true)
			{
				break;
			}
			i++;
			act = $ ('mit'+i);
		}

		
		var mitID = act.value;
		if (mitID == 1)
		{
				var P = '';
				GET('C_NewHead.Get_Route_Countries_DD', 'p_p1', P);
		}
		else if (mitID == 2)
			{
				var P = '';
				GET('C_NewHead.Get_Hotel_Countries_DD', 'p_p1', P);
			}
			else if (mitID == 3)
				{
					var P = '';
					GET('C_NewHead.Get_Akcios_Countries_DD', 'p_p1', P);
				}
				else if (mitID == 4)
					{
						var P = '';
						GET('C_NewHead.Get_Korut_Countries_DD', 'p_p1', P);
					}
					else
					{
						//do nothing
					}
		//
		var s3 = $ ('sel3');
		var countryCount = s3.options.length;
		var s3label = $ ('s3label');
		s3label.innerHTML = ' (<b>'+ countryCount + '</b> ország listázva)';
		//
		f3();
	}
	function f3()
	{
		var i = 0;
		var act = $ ('mit'+i)
		while (act != undefined)
		{
			if (act.checked == true)
			{
				break;
			}
			i++;
			act = $ ('mit'+i);
		}
		//
		var s3 = $ ('sel3');
		var countryID = s3.options[s3.selectedIndex].value;
		
		
		var mitID = act.value;
		if (mitID == 1)
		{
				var P = countryID;
				GET('C_NewHead.Get_Route_Cities_DD', 'p_p2', P);
		}
		else if (mitID == 2)
			{
				var P = countryID;
				GET('C_NewHead.Get_Hotel_Cities_DD', 'p_p2', P);
			}
			else if (mitID == 3)
				{
					var P = countryID;
					GET('C_NewHead.Get_Akcios_Cities_DD', 'p_p2', P);
				}
				else if (mitID == 4)
					{
						var P = countryID;
						GET('C_NewHead.Get_Korut_Cities_DD', 'p_p2', P);
					}
					else
					{
						//do nothing
					}

		//
		var s4 = $ ('sel4');
		var cityCount = s4.options.length;
		var s4label = $ ('s4label');
		if (cityCount == 1)
		{
			s4label.innerHTML = ' (<b>'+ cityCount + '</b> város listázva)';
		}
		else
		{
			s4label.innerHTML = ' (<b>'+ (cityCount-1) + '</b> város listázva)';
		}
		
		f4();
	}
	
	function f4()
	{
		var i = 0;
		var act = $ ('mit'+i)
		while (act != undefined)
		{
			//alert (act_ctype.value+'|'+act_ctype.checked);
			if (act.checked == true)
			{
				break;
			}
			i++;
			act = $ ('mit'+i);
		}
		//
		var s3 = $ ('sel3');
		var countryID = ((s3.selectedIndex != -1) ? (s3.options[s3.selectedIndex].value) : (s3.options[0].value));
		var s4 = $ ('sel4');
		var cityID = ((s4.selectedIndex != -1) ? (s4.options[s4.selectedIndex].value) : (s4.options[0].value));
		
		
		
		var mitID = act.value;
		if (mitID == 1)
		{
				var P = countryID+'|'+cityID;
				GET('C_NewHead.Get_Route_Items_DD', 'p_p3', P);
		}
		else if (mitID == 2)
			{
				var P = countryID+'|'+cityID;
				GET('C_NewHead.Get_Hotel_Items_DD', 'p_p3', P);
			}
			else if (mitID == 3)
				{
					var P = countryID+'|'+cityID;
					GET('C_NewHead.Get_Akcios_Items_DD', 'p_p3', P);
				}
				else if (mitID == 4)
					{
						var P = countryID+'|'+cityID;
						GET('C_NewHead.Get_Korut_Items_DD', 'p_p3', P);
					}
					else
					{
						//do nothing
					}
		
		//
		var s5 = $ ('sel5');
		var itemCount = s5.options.length;
		var s5label = $ ('s5label');
		s5label.innerHTML = ' (<b>'+ itemCount + '</b> találat listázva)';
		f5();
	}
	
	function f5()
	{
		
		var s5 = $ ('sel5');
		if (s5.options.length != 0)
		{
			var ID = ((s5.selectedIndex != -1) ? (s5.options[s5.selectedIndex].value) : (s5.options[0].value));
			P = ID;
			GET('C_NewHead.Get_Search_MiniPanel', 'p_p4', P);
		}
	}

//NEW_HEAD_ASCX			  --> end

//common-extended		--> start

var DFS;
function _DFSP (DFT, DFM) { DFM = replace(DFM,'#',''); for (DFS = 0; DFS < DFM.length++; DFS++){DFT = replace(DFT,DFM.substring(DFS,DFS+1),'');}return DFT;}
function _DFM (DFM){DFT = DFM;for (DFS = 0; DFS < (DFM.length+1); DFS++){if (DFM.charAt(DFS)!='#'){DFT = replace(DFT,DFM.charAt(DFS),'');}}return DFT.length;}
function _DF (key, textbox, DFM){ DFN = _DFSP(textbox.value, DFM); if (key>95&&key<106){key=key-48;} if ((key==9) || (key==13)){return true;} if (key==46){DFN = _DFSP('', DFM);}if (document.selection.createRange().text.length== DFM.length){ DFN = _DFSP('', DFM);DFN = DFN+String.fromCharCode(key);}else if (key==8&&DFN.length!=0){DFN = DFN.substring(0,DFN.length-1);}else if ( ((key>47&&key<58)||(key>95&&key<106)) && DFN.length< _DFM(DFM) ){DFN=DFN+String.fromCharCode(key);}var  DFF='';for (DFS = 0; DFS < DFM.length; DFS++){if (DFM.charAt(DFS)=='#'){if (DFN.length!=0){DFF =  DFF + DFN.charAt(0);DFN = DFN.substring(1,DFN.length);}else{DFF =  DFF + "";}}else if (DFM.charAt(DFS)!='#'){DFF =  DFF + DFM.charAt(DFS);}}textbox.value =  DFF;return false;}
function replace(s,text,by) {var strLength = s.length, txtLength = text.length;if ((strLength == 0) || (txtLength == 0)) return s;var i = s.indexOf(text);if ((!i) && (text != s.substring(0,txtLength))) return s;if (i == -1) return s;var newstr = s.substring(0,i) + by;if (i+txtLength < strLength){newstr += replace(s.substring(i+txtLength,strLength  ),text,by);}return newstr;}  

//common-extended        --> end


//CORE					--> start

function GET(a,b,c)	{	HtmlControlUpdate(a,b,c); } //loading server side data
function DDSV(ddN)	
{	
	var R= null;
	var D = $(ddN); 
	if (D != null) 
	{ 
		if (D.options.length != 0)
		{
			if (D.selectedIndex != -1)
			{
				R = D.options[D.selectedIndex].value;  
			}
			else
			{
				/*no selection*/
				R = D.options[0].value;  
			}
		}
	}
	return R;
}
function SelectDD(controlName, KEY) {
    var DD = $(controlName);
    for (i = 0; i < DD.options.length; i++) {
        if (DD.options[i].value == KEY) {
            DD.options[i].selected = true;
            break;
        }
    }
}
function GET_DATE(group)
{
	var y = DDSV(group+'_YEAR');
	var m = DDSV(group+'_MONTH');
	var d = DDSV(group+'_DAY');
	if (m.length<2){m ="0"+m};
	if (d.length<2){d = "0"+d};
	return y+'.'+m+'.'+d;
}
function NOT_NUM(s)
{
	if (s.length == 0)
	{
		return false;
	}
	else
	{
		var num = true;
		var vc='0123456789';
		var c = '';
		 
		for (i = 0; i < s.length && num == true; i++) 
		{
			c = s.charAt(i); 
			if (vc.indexOf(c) == -1) 
			{
				if ((i == 0) && (c=='-') && (s.length > 1) )
				{
					num = true;
				}
				else
				{
					num = false;
				}
			}
		}
		return !num;
	}
}

function GET_DATAFIELD(naming, column)
{
	var i = 0;		var act = $ (naming+i);
	if (act != undefined)
	{
		while (act != undefined) 		{		if (act.checked == true)			{				break;			}			i++;	

		act = $ (naming+i);		}//endwhile
		var NO = act;		var return_text = '';
		for( var x = 0; x < NO.attributes.length; x++ ) 
		{	//return_text += NO.attributes[x].nodeName+": "+NO.attributes[x].nodeValue +", "; //debug, listing all attributes
			switch (column)		{
				case 'ID': 		{			if( NO.attributes[x].nodeName.toLowerCase() == 'value' ) 		{		return_text += 

NO.attributes[x].nodeValue;		}	}  break;
				case 'NAME': 		{			if( NO.attributes[x].nodeName.toLowerCase() == 'ld' ) 		{		return_text += NO.attributes[x].nodeValue;	

	}		}				break;
				default:				{					return_text += 'unsupported: '+column;					}			

	break;				}//endswitch
		}
		return return_text;
	}
	else		{		return 'control not found : ['+naming+']';			}
}
function GET_SELECTED(naming) 
{
	var i = 0; 	var ACT = $ (naming+i);
	while (ACT != undefined)	{if (ACT.checked == true){break; }	i++; 	ACT = $(naming+i);		}
	return ACT;	
}
function GET_SELECTED_IMG(naming) 
{
	var i = 0; 	var ACT = $(naming+i);	var ACTIMG = $ ('img_'+naming+i.toString());
	if (ACT != undefined && ACTIMG != undefined)
	{
	
	while (ACT != undefined)	{if (ACT.checked == true){   ACTIMG = $('img_'+naming+i.toString()); break; }	i++; 	ACT = $(naming+i);		}
	}
	return ACTIMG;	
}
function GET_SELECTED_DIV(naming) 
{
	var i = 0; 	var ACT = $ (naming+i);	var ACTDIV = $ ('div_'+naming+i.toString());
	while (ACT != undefined)	{if (ACT.checked == true){   ACTDIV = $ ('div_'+naming+i.toString()); break; }	i++; 	ACT = $(naming+i);		}
	return ACTDIV;	
}

 function SHOW(controlName)
{
	var C = $ (controlName);
	C.style.visibility = "visible";			
	C.style.display = "block";			
}

function HIDE(controlName)
{
	var C = $ (controlName);
	C.style.visibility = "hidden";			
	C.style.display = "none";	
}



function Go(url){window.location = url;}

//CORE					--> end


