/*======================================================================================*\
 * Copyright (c) 2008 BLUEWING.BIZ - All Rights Reserved.
 * ======================================================================================
 * No part of this file may be reproduced or transmitted in any form or by any means, 
 * electronic or mechanical, including photocopying and recording, for any purpose 
 * without the express written permission of the owner of copyright.
 * ======================================================================================
 * @filesource       core/control/js/select.js
 * @copyright        Copyright 2007-2010, Bluewing, Florian Tschoerner
 * @link             http://www.bluewing.biz
 * @package          bluewing
 * @since            Bluewing v 2.0.1
 * @version          
 * @modifiedby       
 * @lastmodified     25.03.2010
 * @license          http://www.opensource.org/licenses/mit-license.php The MIT License
\*======================================================================================*/

	/*==================================================================================*\
     *	Function:	select_country()
     *	Purpose:	
     *	Author:		Florian Tschoerner
	 *	Lastmod:	25.03.2010
     *	Params:		none
	 *	Return:		none
    \*==================================================================================*/

	function select_country(params) {
		if (document.getElementsByName("country_id")[0].selectedIndex == 0) {
			document.getElementsByName("county_id")[0].setAttribute("disabled", "disabled");
			document.getElementsByName("county_id")[0].options[0].selected = true;

			if (document.getElementsByName("district_id")[0]) { 
				document.getElementsByName("district_id")[0].setAttribute("disabled", "disabled");
				document.getElementsByName("district_id")[0].options[0].selected = true;
			}

		} else {
			document.getElementsByName("county_id")[0].removeAttribute("disabled");
		}
		
		// ajax request
		if (navigator.appVersion.indexOf("MSIE 7.0")) {
			document.form.submit();
		} else {
			if (document.getElementById("county_id")) {
				ajax_load('county_id', global_appHref+'/select/county', params);
				document.getElementsByName("county_id")[0].focus();
			}
		}
	}



	/*==================================================================================*\
     *	Function:	select_county()
     *	Purpose:	
     *	Author:		Florian Tschoerner
	 *	Lastmod:	25.03.2010
     *	Params:		none
	 *	Return:		none
    \*==================================================================================*/

	function select_county(params) {
		if (document.getElementsByName("county_id")[0].selectedIndex == 0) {
			if (document.getElementsByName("district_id")[0]) {
				document.getElementsByName("district_id")[0].setAttribute("disabled", "disabled");
				document.getElementsByName("district_id")[0].options[0].selected = true;
			}

		} else {
			if (document.getElementsByName("district_id")[0]) { 
				document.getElementsByName("district_id")[0].removeAttribute("disabled");
				document.getElementsByName("district_id")[0].focus();
			}
		}
		
		// ajax request
		if (navigator.appVersion.indexOf("MSIE 7.0")) {
			document.form.submit();
		} else {
			if (document.getElementById("district_id"))
				ajax_load('district_id', global_appHref+'/select/district', params);
		}
	}



	/*==================================================================================*\
     *	Function:	select_district()
     *	Purpose:	
     *	Author:		Florian Tschoerner
	 *	Lastmod:	25.03.2010
     *	Params:		none
	 *	Return:		none
    \*==================================================================================*/

	function select_district(params) {
/*
		if (document.getElementById("selectDistrict").selectedIndex != 0) {
//			ajax_load('selectCity', global_appHref+'/embedd/selectCity', 'district_id='+document.getElementById("selectDistrict").value);
//		} else {
			ajax_load('selectCity', global_appHref+'/embedd/selectCity', params);
		}

		document.getElementById("selectCity").focus();
*/
	}