//var Lokus = new Object();

citygate = {

        /********************************************************************\
        | START searchForm
        \********************************************************************/

        lokus: {
                       
                 
            setMyVals: function()
            {
                this.lokus_countyUrl[0] = "Sverige";
                this.lokus_countyUrl[1] = "Blekinge";
                this.lokus_countyUrl[2] = "Dalarna";
                this.lokus_countyUrl[3] = "Gotland";
                this.lokus_countyUrl[4] = "Gavleborg";
                this.lokus_countyUrl[5] = "Halland";
                this.lokus_countyUrl[6] = "Jamtland";
                this.lokus_countyUrl[7] = "Jonkoping";
                this.lokus_countyUrl[8] = "Kalmar";
                this.lokus_countyUrl[9] = "Kronoberg";
                this.lokus_countyUrl[10] = "Norrbotten";
                this.lokus_countyUrl[11] = "Skane";
                this.lokus_countyUrl[12] = "Stockholm";
                this.lokus_countyUrl[13] = "Sodermanland";
                this.lokus_countyUrl[14] = "Uppsala";
                this.lokus_countyUrl[15] = "Varmland";
                this.lokus_countyUrl[16] = "Vasterbotten";
                this.lokus_countyUrl[17] = "Vasternorrland";
                this.lokus_countyUrl[18] = "Vastmanland";
                this.lokus_countyUrl[19] = "Vastra-Gotaland";
                this.lokus_countyUrl[20] = "Orebro";
                this.lokus_countyUrl[21] = "Ostergotland";
                this.lokus_countyUrl[22] = "Utomlands";                            
                
                    
                this.lokus_portalUrl[0] = "AllaAnnonser";
                //this.lokus_portalUrl[3] = "Fastigheter";
                this.lokus_portalUrl[3] = "Bostad";
                //this.lokus_portalUrl[2] = "Fordon";
                this.lokus_portalUrl[2] = "Motor";
                this.lokus_portalUrl[4] = "Jobb";
                this.lokus_portalUrl[5] = "Prylar";

                this.lokus_professionAreaUrl[0] = "Alla-Branscher";
                this.lokus_professionAreaUrl[2924] = "Administration";
                this.lokus_professionAreaUrl[2925] = "Bostad-Fastighet";
                this.lokus_professionAreaUrl[2926] = "Bygg-Konstruktion-Drift";
                this.lokus_professionAreaUrl[2927] = "Chefsbef-Manag";
                this.lokus_professionAreaUrl[2928] = "Data-IT";
                this.lokus_professionAreaUrl[2929] = "Detaljhandel";
                this.lokus_professionAreaUrl[2930] = "Ekonomi";
                this.lokus_professionAreaUrl[2931] = "Finansverksamhet";
                this.lokus_professionAreaUrl[2932] = "Forskning-utveckl";
                this.lokus_professionAreaUrl[2933] = "Forsaljning";
                this.lokus_professionAreaUrl[2934] = "Hotell-Rest-Konf";
                this.lokus_professionAreaUrl[2935] = "Juridik";
                this.lokus_professionAreaUrl[2936] = "Kyrkor-Trosamfund";
                this.lokus_professionAreaUrl[2937] = "Lantbruk-Skog";
                this.lokus_professionAreaUrl[2938] = "Marknadsforing";
                this.lokus_professionAreaUrl[2939] = "Media-Reklam";
                this.lokus_professionAreaUrl[2940] = "Tjanster-Service";
                this.lokus_professionAreaUrl[2941] = "Fordon-flyg-transport-teknisk";
                this.lokus_professionAreaUrl[2942] = "Utbildning";
                this.lokus_professionAreaUrl[2943] = "Teknik-Verkstad-Industri";
                this.lokus_professionAreaUrl[2944] = "Vard-omsorg";
                this.lokus_professionAreaUrl[2945] = "Ovriga-yrken";
                this.lokus_professionAreaUrl[4104] = "Miljo-Kvalitet";
                this.lokus_professionAreaUrl[4108] = "Turism-Resor";
                this.lokus_professionAreaUrl[4114] = "Ferie-Trainee";


                this.lokus_portalProductTypes[2] = new Array(
                0
                ,1
                ,2
                ,3
                ,4
                ,5
                );
                this.lokus_portalProductTypes[3] = new Array(
                0
                ,6
                ,7
                ,8
                ,9
                ,11
                ,12
                );
                this.lokus_portalProductTypes[4] = new Array(
                0
                ,20
                );
                this.lokus_portalProductTypes[5] = new Array(
                0
                ,31
                ,32
                ,33
                ,34
                ,36
                ,37
                ,38
                ,39
                ,40
                ,41
                ,42
                ,43
                ,44
                ,45
                ,46
                ,47
                );

                this.lokus_ProductTypeName[0] ="Alla kategorier";
                this.lokus_ProductTypeName[1] = "Bil";
                this.lokus_ProductTypeName[2] = "MC & Moped";
                this.lokus_ProductTypeName[3] = "Husvagn & Husbil";
                this.lokus_ProductTypeName[4] = "Båt";
                this.lokus_ProductTypeName[5] = "Övriga fordon";
                this.lokus_ProductTypeName[6] = "Villa & Radhus";
                this.lokus_ProductTypeName[7] = "Fritidshus";
                this.lokus_ProductTypeName[8] = "Bostadsrätt";
                this.lokus_ProductTypeName[9] = "Hyresrätt";
                this.lokus_ProductTypeName[11] = "Lokaler";
                this.lokus_ProductTypeName[12] = "Övrigt Bostad";
                this.lokus_ProductTypeName[31] = "Hobby & Fritid";
                this.lokus_ProductTypeName[32] = "Barnartiklar";
                this.lokus_ProductTypeName[33] = "Film & Musik";
                this.lokus_ProductTypeName[34] = "Cykel";
                this.lokus_ProductTypeName[36] = "Biltillbehör";
                this.lokus_ProductTypeName[37] = "Klockor & Smycken";
                this.lokus_ProductTypeName[38] = "Data & Hemelektronik";
                this.lokus_ProductTypeName[39] = "Hus & Trädgård";
                this.lokus_ProductTypeName[40] = "Kök, Bad & Tvätt";
                this.lokus_ProductTypeName[41] = "Kläder & Skor";
                this.lokus_ProductTypeName[42] = "Möbler & Inredning";
                this.lokus_ProductTypeName[43] = "Musikinstrument";
                this.lokus_ProductTypeName[44] = "Djur & Tillbehör";
                this.lokus_ProductTypeName[45] = "Sport & Motion";
                this.lokus_ProductTypeName[46] = "Övrigt";
                this.lokus_ProductTypeName[47] = "Auktioner & Loppmarknad";

                this.lokus_ProductTypeUrl[0] ="AllaKategorier";
                this.lokus_ProductTypeUrl[1] = "Bil";
                this.lokus_ProductTypeUrl[2] = "MC-Moped";
                this.lokus_ProductTypeUrl[3] = "Husvagn-husbil";
                this.lokus_ProductTypeUrl[4] = "Bat";
                this.lokus_ProductTypeUrl[5] = "Ovriga-fordon";
                this.lokus_ProductTypeUrl[6] = "Villa-Radhus";
                this.lokus_ProductTypeUrl[7] = "Fritidshus";
                this.lokus_ProductTypeUrl[8] = "Bostadsratt";
                this.lokus_ProductTypeUrl[9] = "Hyresratt";
                this.lokus_ProductTypeUrl[11] = "Lokaler";
                this.lokus_ProductTypeUrl[12] = "Ovrigt-Bostad";
                this.lokus_ProductTypeUrl[31] = "Hobby-Fritid";
                this.lokus_ProductTypeUrl[32] = "Barnartiklar";
                this.lokus_ProductTypeUrl[33] = "Film-musik";
                this.lokus_ProductTypeUrl[34] = "Cykel";
                this.lokus_ProductTypeUrl[36] = "Biltillbehor";
                this.lokus_ProductTypeUrl[37] = "Klockor-Smycken";
                this.lokus_ProductTypeUrl[38] = "Data-Hemelektronik";
                this.lokus_ProductTypeUrl[39] = "Hus-Tradgard";
                this.lokus_ProductTypeUrl[40] = "Kok-bad-tvatt";
                this.lokus_ProductTypeUrl[41] = "Klader-skor";
                this.lokus_ProductTypeUrl[42] = "Mobler-inredning";
                this.lokus_ProductTypeUrl[43] = "Musikinstrument";
                this.lokus_ProductTypeUrl[44] = "Djur-Tillbehor";
                this.lokus_ProductTypeUrl[45] = "Sport-motion";
                this.lokus_ProductTypeUrl[46] = "Ovrigt";
                this.lokus_ProductTypeUrl[47] = "Auktioner-Loppmarknad";


               this.lokus_portalAdStatus[0] = new Array(
                1
                ,2
                ,3
                ,4
                ,5
                ,6
                ,7
                );
                                
                this.lokus_portalAdStatus[2] = new Array(
                0
                ,1
                ,2
                );
                this.lokus_portalAdStatus[3] = new Array(
                0
                ,1
                ,2
                ,3
                ,4
                ,5
                );
                this.lokus_portalAdStatus[5] = new Array(
                0
                ,1
                ,2
                ,5
                ,7
                );

                this.lokus_AdStatusName[0] ="Alla";
                this.lokus_AdStatusName[1] = "Säljes";
                this.lokus_AdStatusName[2] = "Köpes";
                this.lokus_AdStatusName[3] = "Uthyres";
                this.lokus_AdStatusName[4] = "Önskas hyra";
                this.lokus_AdStatusName[5] = "Bytes";
                this.lokus_AdStatusName[6] = "Lediga jobb";
                this.lokus_AdStatusName[7] = "Skänkes";

                
                this.lokus_AdStatusUrl[0] ="Alla";
                this.lokus_AdStatusUrl[1] = "Saljes";
                this.lokus_AdStatusUrl[2] = "Kopes";
                this.lokus_AdStatusUrl[3] = "Uthyres";
                this.lokus_AdStatusUrl[4] = "Onskas-hyra";
                this.lokus_AdStatusUrl[5] = "Bytes";                
                this.lokus_AdStatusUrl[6] = "";
                this.lokus_AdStatusUrl[7] = "Skankes";
				
				bValuesSet = true;
            },            
            bValuesSet: false,                       
            lokus_portalUrl : new Array(),
            lokus_professionAreaUrl : new Array(),
            lokus_portalProductTypes : new Array(),
            lokus_ProductTypeName : new Array(),
            lokus_ProductTypeUrl : new Array(),
            lokus_portalAdStatus : new Array(),
            lokus_AdStatusName : new Array(),
            lokus_AdStatusUrl : new Array(),
            lokus_countyUrl : new Array(),
            
            

            /*******************************************************************\
            |************************ lokusAddLoadEvent ************************|
            \*******************************************************************/        
            lokusAddLoadEvent: function(func) {   
                var oldonload = window.onload;   
                if (typeof window.onload != 'function') {   
                    window.onload = func;   
                    } else {   
                    window.onload = function() {   
                    if (oldonload) {   
                    oldonload();   
                    }   
                    func();   
                    }   
                }   
            },  
            
              
            
            /*******************************************************************\
            |********************** lokusAddonkeypressEvent ***********************|
            \*******************************************************************/        
            lokusAddonkeypressEvent: function(controlId,func) {   
                var oldonkeypress = document.getElementById(controlId).onkeypress;   
                if (typeof document.getElementById(controlId).onkeypress != 'function') {   
                    document.getElementById(controlId).onkeypress = func;   
                    } else {   
                    document.getElementById(controlId).onkeypress = function() {   
                    if (oldonkeypress) {   
                    oldonkeypress();   
                    }   
                    func();   
                    }   
                }   
            },             
            /*******************************************************************\
            |********************** lokusAddonChangeEvent ***********************|
            \*******************************************************************/        
            lokusAddonchangeEvent: function(controlId,func) {   
                var oldonchange = document.getElementById(controlId).onchange;   
                if (typeof document.getElementById(controlId).onchange != 'function') {   
                    document.getElementById(controlId).onchange = func;   
                    } else {   
                    document.getElementById(controlId).onchange = function() {   
                    if (oldonchange) {   
                    oldonchange();   
                    }   
                    func();   
                    }   
                }   
            }

		}
    };


	
	
/*******************************************************************\
|************************  citygate_advancedSearch  ******************|
\*******************************************************************/   	
	function citygate_advancedSearch() {
	  this.lokusUrl = '';
	  this.portalSelectId = '';
	  this.searchTextId = '';
	  this.searchText = '';
	  this.lokusSubmitId = '';
	  this.openWin = false;
	    this.lokus_CategoryName = new Array();
        this.lokus_AdStatusSelectName = new Array();
		            this.countySelectId= '';
            this.ProfessionAreaSelectId='';           
		this.countyId = 0;
		this.portalId = "0";
	  
	}

	citygate_advancedSearch.prototype.initAdvanced = function (lokusUrl, portalSelectId, countySelectId, searchTextId, productTypeFordonId, cgAdStatusFordonId, productTypeFastigheterId, cgAdStatusFastigheterId, productTypePrylarId, cgAdStatusPrylarId, cgAdStatusAllaId, lokusSubmitId, ProfessionAreaSelectId, _openWin, DontAddEnterKeypressEvent) {
	    var _this = this;
	    if (_openWin) {
	        _this.openWin = _openWin;
	    }
	    _this.countySelectId = countySelectId;
	    _this.ProfessionAreaSelectId = ProfessionAreaSelectId;
	    if (lokusUrl != "" && lokusUrl != null) {
	        _this.lokusUrl = lokusUrl;
	    }
	    else {
	        _this.lokusUrl = "http://www.lokus.se";
	    }
	    _this.portalSelectId = portalSelectId;
	    _this.searchTextId = searchTextId;
	    var searchText = document.getElementById(_this.searchTextId).value;
	    _this.searchText = searchText;
	    _this.lokusSubmitId = lokusSubmitId;


	    _this.lokusAddonClickEvent(_this.searchTextId, function () { _this.lokusSearchfunc(_this.searchTextId, _this.searchText); });
	    if (DontAddEnterKeypressEvent != true) {
	        var funckHeAdvanced = function (e) {
	            var pK = e ? e.which : window.event.keyCode;
	            if (pK == 13) {
	                _this.lokusSubmitAdvanced(_this.openWin);
	            }
	            return pK = 13;
	        };

	        citygate.lokus.lokusAddonkeypressEvent(_this.searchTextId, funckHeAdvanced);
	        if (_this.portalSelectId) {
	            citygate.lokus.lokusAddonkeypressEvent(_this.portalSelectId, funckHeAdvanced);
	        }
	    }

	    _this.lokusAddonClickEvent(_this.lokusSubmitId, function () { _this.lokusSubmitAdvanced(_this.openWin); });

	    if (citygate.lokus.bValuesSet == false) {
	        citygate.lokus.setMyVals();
	    }

	    _this.lokus_CategoryName[0] = '';
	    _this.lokus_CategoryName[1] = '';
	    _this.lokus_CategoryName[2] = productTypeFordonId;
	    _this.lokus_CategoryName[3] = productTypeFastigheterId;
	    _this.lokus_CategoryName[4] = '';
	    _this.lokus_CategoryName[5] = productTypePrylarId;



	    _this.lokus_AdStatusSelectName[0] = cgAdStatusAllaId;
	    _this.lokus_AdStatusSelectName[1] = '';
	    _this.lokus_AdStatusSelectName[2] = cgAdStatusFordonId;
	    _this.lokus_AdStatusSelectName[3] = cgAdStatusFastigheterId;
	    _this.lokus_AdStatusSelectName[4] = '';
	    _this.lokus_AdStatusSelectName[5] = cgAdStatusPrylarId;

	    _this.Populate();

	}
			
			
/*******************************************************************\
            |*************************  Populate  ******************************|
            \*******************************************************************/
            citygate_advancedSearch.prototype.Populate = function()
            {
                if(this.countySelectId && this.countySelectId!='')
                {
                    var countySelect = document.getElementById(this.countySelectId);
                    countySelect.length=0;
                    countySelect.options[countySelect.options.length] = new Option("Alla län","0");
                    countySelect.options[countySelect.options.length] = new Option("Blekinge","1");
                    countySelect.options[countySelect.options.length] = new Option("Dalarna","2");
                    countySelect.options[countySelect.options.length] = new Option("Gotland","3");
                    countySelect.options[countySelect.options.length] = new Option("Gävleborg","4");
                    countySelect.options[countySelect.options.length] = new Option("Halland","5");
                    countySelect.options[countySelect.options.length] = new Option("Jämtland","6");
                    countySelect.options[countySelect.options.length] = new Option("Jönköping","7");
                    countySelect.options[countySelect.options.length] = new Option("Kalmar","8");
                    countySelect.options[countySelect.options.length] = new Option("Kronoberg","9");
                    countySelect.options[countySelect.options.length] = new Option("Norrbotten","10");
                    countySelect.options[countySelect.options.length] = new Option("Skåne","11");
                    countySelect.options[countySelect.options.length] = new Option("Stockholm","12");
                    countySelect.options[countySelect.options.length] = new Option("Södermanland","13");
                    countySelect.options[countySelect.options.length] = new Option("Uppsala","14");
                    countySelect.options[countySelect.options.length] = new Option("Utomlands","22");
                    countySelect.options[countySelect.options.length] = new Option("Värmland","15");
                    countySelect.options[countySelect.options.length] = new Option("Västerbotten","16");
                    countySelect.options[countySelect.options.length] = new Option("Västernorrland","17");
                    countySelect.options[countySelect.options.length] = new Option("Västmanland","18");
                    countySelect.options[countySelect.options.length] = new Option("Västra Götaland","19");
                    countySelect.options[countySelect.options.length] = new Option("Örebro Län","20");
                    countySelect.options[countySelect.options.length] = new Option("Östergötland","21");
                }
                if(this.ProfessionAreaSelectId && this.ProfessionAreaSelectId!='')
                {

                    var ProfessionAreaSelect = document.getElementById(this.ProfessionAreaSelectId);
                    ProfessionAreaSelect.length=0;
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Alla-Branscher","0");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Administration","2924");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Bostad/Fastighet","2925");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Bygg/Konstruktion/Drift","2926");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Chefsbef./Manag.","2927");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Data/IT","2928");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Detaljhandel","2929");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Ekonomi","2930");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Ferie/Trainee","4114");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Finansverksamhet","2931");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Fordon/flyg/transport-teknisk","2941");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Forskning/utveckl.","2932");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Försäljning","2933");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Hotell/Rest/Konf","2934");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Juridik","2935");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Kyrkor/Trosamfund","2936");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Lantbruk/Skog","2937");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Marknadsföring","2938");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Media/Reklam","2939");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Miljö/Kvalitet","4104");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Teknik/Verkstad/Industri","2943");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Tjänster/Service","2940");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Turism/Resor","4108");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Utbildning","2942");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Vård/omsorg","2944");
                    ProfessionAreaSelect.options[ProfessionAreaSelect.options.length] = new Option("Övriga yrken","2945");
                }
                var i;
                for(i=0;i< this.lokus_CategoryName.length;i++)
                {
                    if(this.lokus_CategoryName[i] && this.lokus_CategoryName[i] != '')
                    {
                        
                        var el = document.getElementById(this.lokus_CategoryName[i]);
                        el.length=0;
                        for( var pIndex =0; pIndex < citygate.lokus.lokus_portalProductTypes[i].length; pIndex++)
                        {
                            el.options[el.options.length] = new Option(citygate.lokus.lokus_ProductTypeName[ citygate.lokus.lokus_portalProductTypes[i][pIndex] ], citygate.lokus.lokus_portalProductTypes[i][pIndex]);
                        }
                    }
                }

                for(i=0;i< this.lokus_AdStatusSelectName.length;i++)
                {
                    if(this.lokus_AdStatusSelectName[i] && this.lokus_AdStatusSelectName[i] != '')
                    {
                        
                        var el = document.getElementById(this.lokus_AdStatusSelectName[i]);
                        el.length=0;
                        for( var pIndex =0; pIndex < citygate.lokus.lokus_portalAdStatus[i].length; pIndex++)
                        {
                            el.options[el.options.length] = new Option(citygate.lokus.lokus_AdStatusName[ citygate.lokus.lokus_portalAdStatus[i][pIndex] ], citygate.lokus.lokus_portalAdStatus[i][pIndex]);
                        }
                    }
                }
                

            }			

			
	/*******************************************************************\
	|************************  lokusSearchfunc  ************************|
	\*******************************************************************/        
	citygate_advancedSearch.prototype.lokusSearchfunc = function(searchTextId, searchText) {
		if(document.getElementById(searchTextId).value == searchText) {
			document.getElementById(searchTextId).value = "";
		}
	}
	  
	  
	  /*******************************************************************\
	|********************** lokusAddonClickEvent ***********************|
	\*******************************************************************/        
	citygate_advancedSearch.prototype.lokusAddonClickEvent = function(controlId,func) {   
		var oldonclick = document.getElementById(controlId).onclick;   
		if (typeof document.getElementById(controlId).onclick != 'function') {   
			document.getElementById(controlId).onclick = func;   
			} else {   
			document.getElementById(controlId).onclick = function() {   
			if (oldonclick) {   
			oldonclick();   
			}   
			func();   
			}   
		}   
	}	
	/*******************************************************************\
            |************************   lokusSubmit  ***************************|
            \*******************************************************************/
            citygate_advancedSearch.prototype.lokusSubmitAdvanced = function(openWin)
            {
	            //var lokusUrl = 'http://corren.lokus.se/';
	            var lokusUrl = this.lokusUrl;// 'http://localhost:50020/';
	            
	            //this.countyId = 0;
	            if(this.countySelectId && this.countySelectId !='') this.countyId = document.getElementById(this.countySelectId).value; // Län
	            
	            //this.portalId = "0";
				if(this.portalSelectId && this.portalSelectId !='') this.portalId = document.getElementById(this.portalSelectId).value; // Portal
                
	            this.lokusSearchfunc(this.searchTextId, this.searchText);
            	
	            var _lokus_ProductTypeUrl='';
	            var _lokus_AdStatusUrl='';
	            var _lokus_professionAreaUrl='';
            	
	            switch( this.portalId)
	            {
	                case "0":
	                    if(this.lokus_AdStatusSelectName[this.portalId] && this.lokus_AdStatusSelectName[this.portalId] != '')
	                    {
	                        _lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[document.getElementById(this.lokus_AdStatusSelectName[this.portalId]).value];
	                    }
	                    else{
	                        _lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[0];
	                    }
	                    if(document.getElementById(this.lokus_AdStatusSelectName[this.portalId]).value != "6")
	                    {
	                        _lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[0];
	                        if(!openWin)
	                        {
	                            document.location.href = lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
	                        }
	                        else{
	                            window.open(lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
	                        }
	                    }
	                    else
	                    {
	                        _lokus_professionAreaUrl = citygate.lokus.lokus_professionAreaUrl[0];
  	                        if(!openWin)
	                        {
                                document.location.href = lokusUrl + 'Jobb/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + _lokus_professionAreaUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
	                        }
	                        else{
                                window.open(lokusUrl + 'Jobb/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + _lokus_professionAreaUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
                            }
                        }
	                
	                break;
	                case "2":
						if(this.lokus_CategoryName[this.portalId] && this.lokus_CategoryName[this.portalId] != '')
						{
							_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[document.getElementById(this.lokus_CategoryName[this.portalId]).value];
						}
						else
						{
							_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[0];
						}
						if(this.lokus_AdStatusSelectName[this.portalId] && this.lokus_AdStatusSelectName[this.portalId] != '')
						{
							_lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[document.getElementById(this.lokus_AdStatusSelectName[this.portalId]).value];
						}
	                    else{
	                        _lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[0];
	                    }
	                    if(!openWin)
	                    {
	                        document.location.href = lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
	                    }
	                    else{
	                        window.open(lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
	                    }
	                break;
	                case "3":
						if(this.lokus_CategoryName[this.portalId] && this.lokus_CategoryName[this.portalId] != '')
						{
							_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[document.getElementById(this.lokus_CategoryName[this.portalId]).value];
						}
						else
						{
							_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[0];
						}
						
						if(this.lokus_AdStatusSelectName[this.portalId] && this.lokus_AdStatusSelectName[this.portalId] != '')
						{
							_lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[document.getElementById(this.lokus_AdStatusSelectName[this.portalId]).value];
						}
	                    else{
	                        _lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[0];
	                    }

						if(!openWin)
	                    {
	                        document.location.href = lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
	                    }
	                    else{
	                        window.open(lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
	                    }
	                break;
	                case "4":
						if(this.ProfessionAreaSelectId && this.ProfessionAreaSelectId !='')
						{
							_lokus_professionAreaUrl = citygate.lokus.lokus_professionAreaUrl[document.getElementById(this.ProfessionAreaSelectId).value];
						}
						else
						{						
							_lokus_professionAreaUrl = citygate.lokus.lokus_professionAreaUrl[0];
						}
  	                    if(!openWin)
	                    {
                            document.location.href = lokusUrl + 'Jobb/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + _lokus_professionAreaUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
	                    }
	                    else{
                            window.open(lokusUrl + 'Jobb/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + _lokus_professionAreaUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
                        }
	                break;
	                case "5":
						if(this.lokus_CategoryName[this.portalId] && this.lokus_CategoryName[this.portalId] != '')
						{
							_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[document.getElementById(this.lokus_CategoryName[this.portalId]).value];
						}
						else
						{
							_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[0];
						}
						
						if(this.lokus_AdStatusSelectName[this.portalId] && this.lokus_AdStatusSelectName[this.portalId] != '')
						{
							_lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[document.getElementById(this.lokus_AdStatusSelectName[this.portalId]).value];
						}
	                    else{
	                        _lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[0];
	                    }
   	                    if(!openWin)
	                    {
                            document.location.href = lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
                        }
	                    else
	                    {
                            window.open(lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
                            // + '&SC_Z=13539'
                        }
                        //alert(lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
	                break;
	                default:
   	                    if(!openWin)
	                    {
    	                    document.location.href = lokusUrl;
    	                }
	                    else
	                    {
	                        window.open(lokusUrl);
                        }
	                break;

	            }
            	
	            //document.lokussearch.NewUrl.value = strSearchPage + '?searchCategoryText=' + encodeURIComponent(searchCategoryText) + '&searchWhatText=' + encodeURIComponent(document.lokussearch.searchWhatText.value);
            	
            	
            }

	
/*******************************************************************\
|************************  citygate_simpleSearch  ******************|
\*******************************************************************/   	
	function citygate_simpleSearch() {
	  this.lokusUrl = '';
	  this.portalSelectId = '';
	  this.searchTextId = '';
	  this.searchText = '';
	  this.lokusSubmitId = '';
	  this.openWin = false;
		this.countyId = 0;
		this.portalId = "0";	  
	  
	}

		
			
	citygate_simpleSearch.prototype.initSimple = function(lokusUrl, portalSelectId, searchTextId,lokusSubmitId,_openWin, DontAddEnterKeypressEvent) {
		var _this = this;
		if(_openWin)
		{
			_this.openWin=_openWin;
		}
        if (lokusUrl != "" && lokusUrl != null) {
            _this.lokusUrl = lokusUrl;
        }
        else {
            _this.lokusUrl = "http://www.lokus.se";
        }
		_this.portalSelectId = portalSelectId;
		_this.searchTextId = searchTextId;
		var searchText = document.getElementById(_this.searchTextId).value;
		_this.searchText = searchText;  
		_this.lokusSubmitId = lokusSubmitId;
		
		

		_this.lokusAddonClickEvent(searchTextId, function(){_this.lokusSearchfunc(_this.searchTextId, _this.searchText);});
		if(DontAddEnterKeypressEvent != true)
		{
			var funckHeSimple = function (e) {                
				var pK = e ? e.which : window.event.keyCode;
				if (pK == 13) {
				   _this.lokusSubmitSimple(_this.openWin);
				}
				return pK = 13;
			};

			citygate.lokus.lokusAddonkeypressEvent(_this.searchTextId, funckHeSimple);
			if(_this.portalSelectId && _this.portalSelectId !='')
			{
				citygate.lokus.lokusAddonkeypressEvent(_this.portalSelectId, funckHeSimple);
			}
		}

		
		_this.lokusAddonClickEvent(_this.lokusSubmitId, function(){_this.lokusSubmitSimple(_this.openWin);});
		  
		if(citygate.lokus.bValuesSet == false)
		{
			citygate.lokus.setMyVals();
		}               
	 
	}
	/*******************************************************************\
	|************************  lokusSearchfunc  ************************|
	\*******************************************************************/        
	citygate_simpleSearch.prototype.lokusSearchfunc = function(searchTextId, searchText) {
		if(document.getElementById(searchTextId).value == searchText) {
			document.getElementById(searchTextId).value = "";
		}
	}
	  
	  
	  /*******************************************************************\
	|********************** lokusAddonClickEvent ***********************|
	\*******************************************************************/        
	citygate_simpleSearch.prototype.lokusAddonClickEvent = function(controlId,func) {   
		var oldonclick = document.getElementById(controlId).onclick;   
		if (typeof document.getElementById(controlId).onclick != 'function') {   
			document.getElementById(controlId).onclick = func;   
			} else {   
			document.getElementById(controlId).onclick = function() {   
			if (oldonclick) {   
			oldonclick();   
			}   
			func();   
			}   
		}   
	}
	  
	citygate_simpleSearch.prototype.lokusSubmitSimple =  function(openWin)
	{
		//var lokusUrl = 'http://corren.lokus.se/';
		var lokusUrl = this.lokusUrl;// 'http://localhost:50020/';
		//this.countyId = 0;
		
		//this.portalId = "0";
		if(this.portalSelectId && this.portalSelectId !='') this.portalId = document.getElementById(this.portalSelectId).value; // Portal

		//		var countyId = 0;
		
//		var portalId = document.getElementById(this.portalSelectId).value; // Portal
		
		this.lokusSearchfunc(this.searchTextId, this.searchText);
		
		
		switch( this.portalId)
		{
			case "0":
				_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[0];
				_lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[0];
				if(!openWin)
				{
					document.location.href = lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
				}
				else{
					window.open(lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
				}
		
			break;
			case "2":
				_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[0];
				_lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[0];
				if(!openWin)
				{
					document.location.href = lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
				}
				else{
					window.open(lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
				}
			break;
			case "3":
				_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[0];
				_lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[0];
				if(!openWin)
				{
					document.location.href = lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
				}
				else{
					window.open(lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
				}
			break;
			case "4":
				_lokus_professionAreaUrl = citygate.lokus.lokus_professionAreaUrl[0];
				if(!openWin)
				{
					document.location.href = lokusUrl + 'Jobb/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + _lokus_professionAreaUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
				}
				else{
					window.open(lokusUrl + 'Jobb/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + _lokus_professionAreaUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
				}
			break;
			case "5":
				_lokus_ProductTypeUrl = citygate.lokus.lokus_ProductTypeUrl[0];
				_lokus_AdStatusUrl = citygate.lokus.lokus_AdStatusUrl[0];
				if(!openWin)
				{
					document.location.href = lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value)
				}
				else
				{
					window.open(lokusUrl + 'Hitta/' + citygate.lokus.lokus_countyUrl[this.countyId] + '/' + citygate.lokus.lokus_portalUrl[this.portalId] + '/' + _lokus_ProductTypeUrl + '/' + _lokus_AdStatusUrl + '/?SC=1&SC_F=' + encodeURIComponent(document.getElementById(this.searchTextId).value));
					// + '&SC_Z=13539'
				}                        
			break;
			default:
				if(!openWin)
				{
					document.location.href = lokusUrl;
				}
				else
				{
					window.open(lokusUrl);
				}
			break;

		}            	
	}
