﻿// Handle the change in the drop down which select
// which client type 
//   uses handle input to insert text to inputbox to continue 
//   validation (S/C)
function define_customerType()
{	
	var selectObj = document.getElementById("selectCustomerType");
	var hp_line = document.getElementById("hp_line");
	var tz_line = document.getElementById("tz_line");	
	var companyName_line = document.getElementById("companyName_line");	
	var firstName_line = document.getElementById("firstName_line");	
	var lastName_line = document.getElementById("lastName_line");	
	var space_line = document.getElementById("space_line");
		
	var ContactFirstName_line = document.getElementById("ContactFirstName_line");	
	var ContactLastName_line = document.getElementById("ContactLastName_line");	
	var ContactRole_line = document.getElementById("ContactRole_line");	
	var ContactTitle_line = document.getElementById("ContactTitle_line");
	var space_line1 = document.getElementById("space_line1");
	var space_line2 = document.getElementById("space_line2");

	
	if(selectObj.selectedIndex == 0) // iski 
	{
		
		handleinput(1,'tz');
		handleinput(0,'hp');
		handleinput(1,'first');
		handleinput(1,'last');
		handleinput(0,'company');
		handleinput(0,'contactFirst');
		handleinput(0,'contactLast');
		handleinput(0,'contactRole');		
		companyName_line.className = "showTextArea";
		hp_line.className = "showTextArea";
		
		ContactFirstName_line.className = "showTextArea";
		ContactLastName_line.className = "showTextArea";
		ContactRole_line.className = "showTextArea";
	
		ContactTitle_line.className = "showTextArea";		
		
		//space_line.className = "showTextArea";		
		space_line.className = "hideTextArea";
		space_line1.className = "showTextArea";
		space_line2.className = "showTextArea";
	
		
		
		tz_line.className = "hideTextArea";
		firstName_line.className = "hideTextArea";
		lastName_line.className = "hideTextArea";
		
	}
	else if(selectObj.selectedIndex == 1) // osek murshe
	{
		handleinput(0,'tz');
		handleinput(1,'hp');
		handleinput(0,'first');
		handleinput(0,'last');
		handleinput(1,'company');
		handleinput(1,'contactFirst');
		handleinput(1,'contactLast');
		handleinput(1,'contactRole');
		
		tz_line.className = "showTextArea";
		firstName_line.className = "showTextArea";
		lastName_line.className = "showTextArea";
		space_line.className = "showTextArea";
		
		
		hp_line.className = "hideTextArea";
		companyName_line.className = "hideTextArea";
		ContactFirstName_line.className = "hideTextArea";
		ContactLastName_line.className = "hideTextArea";
		ContactRole_line.className = "hideTextArea";
		ContactTitle_line.className = "hideTextArea";
		
		space_line1.className = "hideTextArea";
		space_line2.className = "hideTextArea";
		
		
		//space_line2.className = "hideTextArea";
		//space_line3.className = "hideTextArea";
		//space_line4.className = "hideTextArea";
	}
	else // prati
	{
		handleinput(0,'tz');
		handleinput(1,'hp');
		handleinput(0,'first');
		handleinput(0,'last');
		handleinput(1,'company');
		handleinput(1,'contactFirst');
		handleinput(1,'contactLast');
		handleinput(1,'contactRole');
		
		tz_line.className = "showTextArea";
		firstName_line.className = "showTextArea";
		lastName_line.className = "showTextArea";
		space_line.className = "showTextArea";
		
		hp_line.className = "hideTextArea";
		companyName_line.className = "hideTextArea";
		
		ContactFirstName_line.className = "hideTextArea";
		ContactLastName_line.className = "hideTextArea";
		ContactRole_line.className = "hideTextArea";
		ContactTitle_line.className = "hideTextArea";
		
		space_line1.className = "hideTextArea";
		space_line2.className = "hideTextArea";
	
		
	}	
}
function define_customerTypeNew(selectCustomerType)
{	
	
	var companyName_line = document.getElementById("companyName_line");	
	
	var selectObj = document.getElementById(selectCustomerType);
	
	
	if (selectObj==null)
		return;
	
	var hp_line = document.getElementById("hp_line");
	var tz_line = document.getElementById("tz_line");	
	
	var firstName_line = document.getElementById("firstName_line");	
	var lastName_line = document.getElementById("lastName_line");	
	var space_line = document.getElementById("space_line");
		
	var ContactFirstName_line = document.getElementById("ContactFirstName_line");	
	var ContactLastName_line = document.getElementById("ContactLastName_line");	
	var ContactRole_line = document.getElementById("ContactRole_line");	
	var ContactTitle_line = document.getElementById("ContactTitle_line");
	var space_line1 = document.getElementById("space_line1");
	var space_line2 = document.getElementById("space_line2");

	
	if(selectObj.selectedIndex == 0) // iski 
	{
		
				
		companyName_line.className = "showTextArea";
		hp_line.className = "showTextArea";
		
		ContactFirstName_line.className = "showTextArea";
		ContactLastName_line.className = "showTextArea";
		ContactRole_line.className = "showTextArea";
	
		ContactTitle_line.className = "showTextArea";		
		
		//space_line.className = "showTextArea";		
		space_line.className = "hideTextArea";
		space_line1.className = "showTextArea";
		space_line2.className = "showTextArea";
	
		
		
		tz_line.className = "hideTextArea";
		firstName_line.className = "hideTextArea";
		lastName_line.className = "hideTextArea";
		
	}
	else if(selectObj.selectedIndex == 1) // osek murshe
	{
		
		
		tz_line.className = "showTextArea";
		firstName_line.className = "showTextArea";
		lastName_line.className = "showTextArea";
		space_line.className = "showTextArea";
		
		
		hp_line.className = "hideTextArea";
		companyName_line.className = "hideTextArea";
		ContactFirstName_line.className = "hideTextArea";
		ContactLastName_line.className = "hideTextArea";
		ContactRole_line.className = "hideTextArea";
		ContactTitle_line.className = "hideTextArea";
		
		space_line1.className = "hideTextArea";
		space_line2.className = "hideTextArea";
		
		
		//space_line2.className = "hideTextArea";
		//space_line3.className = "hideTextArea";
		//space_line4.className = "hideTextArea";
	}
	else // prati
	{
		
		
		tz_line.className = "showTextArea";
		firstName_line.className = "showTextArea";
		lastName_line.className = "showTextArea";
		space_line.className = "showTextArea";
		
		hp_line.className = "hideTextArea";
		companyName_line.className = "hideTextArea";
		
		ContactFirstName_line.className = "hideTextArea";
		ContactLastName_line.className = "hideTextArea";
		ContactRole_line.className = "hideTextArea";
		ContactTitle_line.className = "hideTextArea";
		
		space_line1.className = "hideTextArea";
		space_line2.className = "hideTextArea";
	
		
	}	
}
function define_IsUpdateForOtherVehicle()
{
	var rdb_is_update			= document.getElementById('rdb_is_update');
	var rdb_is_not_update		= document.getElementById('rdb_is_not_update');
	
	var row_enter_licensing_num = document.getElementById('row_enter_licensing_num');
	
	if(rdb_is_update.checked == true)
	{
		row_enter_licensing_num.className = "showTextArea";
	}
	else
	{
		row_enter_licensing_num.className = "hideTextArea";
	}
	
	
}




//function which handle insert/delete text in inputfield
//type -> hp ,tz , first ,company last
//handleinput(1,
var heb = 'ריק';
function handleinput( role , type)
{
	if (role) //add value
	{
		if ( type == 'tz')
		{
		  var inputT = document.getElementById("txtTz");		  
		  inputT.value='000000000';
		}
		if (type=='hp')
		{
		 var inputH = document.getElementById("txtHp");
		 inputH.value='123456789';
		}
		if (type=='first')
		{		
			var inputQ = document.getElementById("txtFirstName");	
			inputQ.value=heb;
		}
		if (type=='last')
		{
			var inputQ2 = document.getElementById("txtLastName");
			inputQ2.value=heb;
		}
		if (type=='company')
		{
			var inputQ1 = document.getElementById("txtCompanyName");
			 inputQ1.value=heb;
		}
		if (type=='contactFirst')
		{
			var inputQ1 = document.getElementById("txtContactFirstName");
			 inputQ1.value=heb;
		}
		if (type=='contactLast')
		{
			var inputQ1 = document.getElementById("txtContactLastName");
			 inputQ1.value=heb;
		}
		if (type=='contactRole')
		{
			var inputQ1 = document.getElementById("txtContactRole");
			 inputQ1.value=heb;
		}	
	}
	else
	{
		if ( type == 'tz')
		{
		  var inputT = document.getElementById("txtTz");		  
		  inputT.value='';
		}
		if (type=='hp')
		{
		 var inputH = document.getElementById("txtHp");
		 inputH.value='';
		}
		if (type=='first')
		{		
			var inputQ = document.getElementById("txtFirstName");	
			inputQ.value='';
		}
		if (type=='last')
		{
			var inputQ2 = document.getElementById("txtLastName");
			inputQ2.value='';
		}
		if (type=='company')
		{
			var inputQ1 = document.getElementById("txtCompanyName");
			 inputQ1.value='';
		}
		if (type=='contactFirst')
		{
			var inputQ1 = document.getElementById("txtContactFirstName");
			 inputQ1.value='';
		}
		if (type=='contactLast')
		{
			var inputQ1 = document.getElementById("txtContactLastName");
			 inputQ1.value='';
		}
		if (type=='contactRole')
		{
			var inputQ1 = document.getElementById("txtContactRole");
			 inputQ1.value='';
		}	
	}	
}

// Cleanselected will run in the body onLoad function
// it's prpose is to clean hidden values which
// the user didn't type.
// The main use is for postback and load.
// it uses an other loading type 
function cleanSlected()
{	
	define_customerType2()	
}

// Handle the change in the drop down which select
// which client type 
//   uses handle input to insert text to inputbox to continue 
//   validation (S/C)
// THE MAIN Change between the first one is the none deletion
//  of the input fileds the users as entered. 
function define_customerType2()
{
var selectObj = document.getElementById("selectCustomerType");
	var hp_line = document.getElementById("hp_line");
	var tz_line = document.getElementById("tz_line");	
	var companyName_line = document.getElementById("companyName_line");	
	var firstName_line = document.getElementById("firstName_line");	
	var lastName_line = document.getElementById("lastName_line");	
	var space_line = document.getElementById("space_line");
		
	var ContactFirstName_line = document.getElementById("ContactFirstName_line");	
	var ContactLastName_line = document.getElementById("ContactLastName_line");	
	var ContactRole_line = document.getElementById("ContactRole_line");	
	var ContactTitle_line = document.getElementById("ContactTitle_line");
	var space_line1 = document.getElementById("space_line1");
	var space_line2 = document.getElementById("space_line2");
	
	
	
	if(selectObj.selectedIndex == 0) // iski 
	{
		
		handleinput(1,'tz');
		//handleinput(0,'hp');
		handleinput(1,'first');
		handleinput(1,'last');
		//handleinput(0,'company');
		//handleinput(0,'contactFirst');
		//handleinput(0,'contactLast');
		//handleinput(0,'contactRole');
		
		companyName_line.className = "showTextArea";
		hp_line.className = "showTextArea";
		
		ContactFirstName_line.className = "showTextArea";
		ContactLastName_line.className = "showTextArea";
		ContactRole_line.className = "showTextArea";
	
		ContactTitle_line.className = "showTextArea";		
		
		space_line.className = "hideTextArea";	
		space_line1.className = "showTextArea";
		space_line2.className = "showTextArea";
		

		tz_line.className = "hideTextArea";
		firstName_line.className = "hideTextArea";
		lastName_line.className = "hideTextArea";
		
	}
	else if(selectObj.selectedIndex == 1) // osek murshe
	{
		//handleinput(0,'tz');
		handleinput(1,'hp');
		//handleinput(0,'first');
		//handleinput(0,'last');
		handleinput(1,'company');
		handleinput(1,'contactFirst');
		handleinput(1,'contactLast');
		handleinput(1,'contactRole');
		
		tz_line.className = "showTextArea";
		firstName_line.className = "showTextArea";
		lastName_line.className = "showTextArea";
		space_line.className = "showTextArea";
		
		
		hp_line.className = "hideTextArea";
		companyName_line.className = "hideTextArea";
		ContactFirstName_line.className = "hideTextArea";
		ContactLastName_line.className = "hideTextArea";
		ContactRole_line.className = "hideTextArea";
		ContactTitle_line.className = "hideTextArea";
		
		space_line1.className = "hideTextArea";
		space_line2.className = "hideTextArea";
	
	}
	else // prati
	{	
		//handleinput(0,'tz');
		handleinput(1,'hp');
		//handleinput(0,'first');
		//handleinput(0,'last');
		handleinput(1,'company');
		handleinput(1,'contactFirst');
		handleinput(1,'contactLast');
		handleinput(1,'contactRole');		
		
		tz_line.className = "showTextArea";
		firstName_line.className = "showTextArea";
		lastName_line.className = "showTextArea";
		space_line.className = "showTextArea";
		
		hp_line.className = "hideTextArea";
		companyName_line.className = "hideTextArea";
		
		ContactFirstName_line.className = "hideTextArea";
		ContactLastName_line.className = "hideTextArea";
		ContactRole_line.className = "hideTextArea";
		ContactTitle_line.className = "hideTextArea";
		
		space_line1.className = "hideTextArea";
		space_line2.className = "hideTextArea";
		
				
	}	
}
var textArr = new Array("אביאל","אביחיל","אבן יהודה","אבן ספיר","אדם","אודים","אור יהודה","אור עקיבא","אורטל","אושה","אזור","אחזת ברק","אחיסמך","אחיעזר","איל","אלון הגליל","אלוני הבשן","אליכין","אלעד","אלפי מנשה","אלקנה","אמנון","אניעם","אפקים","אפרתה","ארבל","אריאל","ארנית","אשדוד","אשקלון","באר יעקב","באר שבע","בארי","בית אלעזרי","בית אריה","בית גמליאל","בית דגן","בית הגדי","בית זית","בית חנניה","בית חשמונאי","בית יהושע","בית יצחק-שער","בית נחמיה","בית עובד","בית עריף","בית שאן","בית שמש","בית שערים","ביתן אהרן","ביתר עלית","בן עמי","בן שמן )מושב(","בן שמן)כפר נע","בני ברק","בני עי ש","בני ציון","בנימינה","בצרה","בצרון","בר גיורא","בת חפר","בת ים","גאולי תימן","גאליה","גבע כרמל","גבעת אבני","גבעת אלה","גבעת ברנר","גבעת זאב","גבעת ח ן","גבעת כ ח","גבעת עדה","גבעת שמואל","גבעתי","גבעתים","גבתון","גדרה","גזית","גזר","גילון","גליל ים","גמזו","גן יבנה","גן שלמה","גנות","גני יוחנן","גני תקוה","גנתון","גסר א-זרקא","גת רמון","גת)קבוץ(","דימונה","הדר עם","הוד השרון","הזורע","החותרים","הרצליה","זיתן","זכרון יעקב","חבצלת השרון","חדיד","חדרה","חולון","חולתה","חיפה","חמד","חצור הגלילית","חצור-אשדוד","חצרים","חרב לאת","חרוצים","טבריה","טירת כרמל","יבנאל","יבנה","יגל","יהוד","יונתן","יסוד המעלה","יקנעם עלית","יקנעם)מושבה(","ירוחם","ירושלים","יתד","כוכב יאיר","כנף","כנרת)מושבה(","כפר ביל ו","כפר גליקסון","כפר הנגיד","כפר הס","כפר ויתקין","כפר ורדים","כפר חיים","כפר טרומן","כפר יונה","כפר מרדכי","כפר סבא","כפר סירקין","כפר פינס","כפר רות","כפר שמואל","כפר שמריהו","כפר תבור","כרם שלום","כרמיאל","לביא","לבנים","להבים","לוד","לטם","לפיד","מבוא ביתר","מבועים","מבשרת ציון","מגדל","מגדל העמק","מדרך עז","מודיעין","מורשת","מזור","מזכרת בתיה","מזרע","מחסיה","מטולה","מי עמי","מישר","מיתר","מכבים-רעות","מכמרת","מנוף","מנחמיה","מסלות","מעין צבי","מעלה אדמים","מעלה אפרים","מעלה גמלא","מעלות-תרשיחא","מצליח","מצפה","מצפה רמון","משגב דב","משמר אילון","משמר השבעה","משמרות","מתן","נאות הככר","נגה","נהורה","נהריה","נוה אפרים","נוה זהר","נוה מבטח","נופית","נחלים","נירים","נס ציונה","נצני עז","נצר סרני","נצרת","נצרת עלית","נשר","נתיבות","נתניה","סביון","עדי","עוזה","עזר","עזריה","עין הבשור","עין כרמל","עין שמר","עכו","עמיעז","עמיקם","עמנואל","עמר","עפולה","עצם","ערד","עשרת","עתלית","פדויים","פוריה עלית","פוריה-נוה עוב","פטיש","פרדס חנה-כרכו","פרי גן","פתח תקוה","צור יגאל","צורית","צורן","צפת","צרופה","קדימה","קיסריה","קצרין","קרית אונו","קרית ארבע","קרית אתא","קרית ביאליק","קרית גת","קרית טבעון","קרית ים","קרית מוצקין","קרית מלאכי","קרית ענבים","קרית עקרון","קרית שמונה","קרני שומרון","קשת","ראש העין","ראש פנה","ראשון לציון","רחובות","רכסים","רמות השבים","רמות מאיר","רמות מנשה","רמלה","רמת אפעל","רמת גן","רמת השופט","רמת השרון","רמת יוחנן","רמת ישי","רמת רזיאל","רנתיה","רעננה","רשפון","שבי ציון","שגב","שדה יצחק","שדות ים","שדרות","שוהם","שילת","שלומי","שעלבים","שער אפרים","שריגים)לי-און","תל אביב -יפו","תל יצחק","תל מונד");
function fillDropDown()
{
var city = document.getElementById("ddl_city");
	for (var i=0; i<textArr.length; ++i)
	{	
	city.options[i] = new Option(textArr[i], '0' , false, false);
	}	
	city.options[0].selected = true;
	alert(city.options[0].selected);
}	
