
$(document).ready(function () {

    ShowPages();

    jQuery('.cycle').cycle({
        speed: 600,
        pause: 1,
        timeout: 6000
    });

    //location_header
    InitLocations();

    if ($("#contactform").length > 0) {
        var validator;
        validator = $("#contactform").validate();
    }

    $('.country').change(function () {
        fillStates();
        $.ajax({
            url: "/ajax.aspx",
            data: "action=getRegion&country=" + $('.country').val(),
            type: "post",
            dataType: "text",
            success: function (res) {

                $('#hdnRegion').val(res);

                if ($('.country').val() != 'us' && $('.country').val() != 'ca') {
                    $('#phone').removeClass('phoneUS').addClass('phoneInt');
                    $('#state').removeClass('required');
                    //alert('changed phone validation:'+$('.country').val());
                    if ($("#contactform").length > 0) {
                        validator.resetForm();
                    }
                    $('#phone').focusout();
                } else {
                    $('#phone').removeClass('phoneInt').addClass('phoneUS');
                    $('#state').addClass('required');
                    $('hdnRegion').val('Americas');
                    //alert('Americas');
                    if ($("#contactform").length > 0) {
                        validator.resetForm();
                    }
                    $('#phone').focusout();
                }
            }
        });
    });

    //set country dropdowns based on country
    var countryCode = document.location.host.replace('www.', '').replace('alliedtelesis', '').replace('com.', '').replace('co.', '').replace('.', '').replace('allied-', '').replace("magiclamp.net", '');
    if (countryCode == 'com' || countryCode == 'alliedtelesis' || countryCode == 'allied') { countryCode = 'us'; }


    if (document.location.host.indexOf('magiclamp') > -1) {
        $('body').append('<div style="position: absolute; top: 10px; right: 10px; padding: 10px; border: 1px solid #aaa; background: #ccc">' + countryCode + '</div>');
    }

    $('.drpCountry').html("");
    $('.drpCountry').append('<option value="">Select a Country</option>');
    $('.drpCountry').removeClass('country');

    if ($('.drpCountry').length > 0) {
        $.ajax({
            url: "/ajax.aspx",
            data: "action=getCountries",
            type: "post",
            dataType: "text",
            success: function (res) {
                var countries = res.split('###');
                $(countries).each(function () {
                    if ($(this).length > 0) {
                        var countrySplit = this.split('-')
                        $('.drpCountry').append('<option value="' + countrySplit[1] + '">' + countrySplit[0] + '</option>');
                    }
                });
                $('.drpCountry option[value="' + countryCode + '"]').attr('selected', 'selected');
                $('.drpCountry').change(function () {
                    $.ajax({
                        url: "/ajax.aspx",
                        data: "action=getRegion&country=" + $(this).val(),
                        type: "post",
                        dataType: "text",
                        success: function (res) {
                            drpCountryChange(res);
                        }
                    });
                });
                $('.drpcountry').trigger('change');
            }
        });
    }

    if ($('.country').length > 0) {
        $('.country').html("");
        $('.country').append('<option value="">Select a Country</option>');
        $.ajax({
            url: "/ajax.aspx",
            data: "action=getCountries",
            type: "post",
            dataType: "text",
            success: function (res) {
                var countries = res.split('###');
                $(countries).each(function () {
                    if ($(this).length > 0) {
                        var countrySplit = this.split('-')
                        $('.country').append('<option value="' + countrySplit[1] + '">' + countrySplit[0] + '</option>');
                    }
                });
                $('.country option[value="' + countryCode + '"]').attr('selected', 'selected');
                $('.country').trigger('change');
            }
        });
    }




    jQuery.validator.addMethod("phoneUS", function (phone_number, element) {
        phone_number = phone_number.replace(/\s+/g, "");
        return this.optional(element) || phone_number.length > 9 &&
			phone_number.match(/^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/);
    }, "Please specify a valid phone number");

    jQuery.validator.addMethod("phoneInt", function (phone_number, element) {
        phone_number = phone_number.replace(/\s+/g, "");
        return this.optional(element) || phone_number.length > 9 &&
			phone_number.match(/^\+(?:[0-9] ?){6,14}[0-9]$/);
    }, "Please specify a valid international phone number, e.g. +44 0800 777 777");




    //event dlg
    if (location.href.indexOf('events') != -1) {
        $('.tbpageslist a').click(function () {
            if (this.hostname == "www.alliedtelesis.com")
                ajax_link(this);
            else
                return true;
            return false;
        });
    }


    Initfmsearchproduct();


    //hide datasheet
    $('div a[href^=/media/datasheets/], div a[href^=/media/fount/], div a[href^=/userfiles/file/]').each(function () {
        if ($(this).text().indexOf('Download ') != -1) {
            //$(this).parent().addClass('removeit');
            $(this).addClass('medium products button ierounded');
            $(this).css('width', 'auto');
        }
    });
    // $('.removeit').remove();

    //autofields
    InitFormFields();
    InitValidations();

    $('#search').keyup(function (e) {
        //alert(e.keyCode);
        if (e.keyCode == 13) {
            //alert('Enter key was pressed.');
            location.href = '/search.aspx?keyword=' + $('#search').val();
        }
    });

    $('#producttable').find(':input').each(function () {
        if ($(this).attr('name') == "Region") {
            $(this).parent().parent().remove();
            $('#producttable').append('<input type="hidden" id="hdnRegion" name="region"/>');
            $('.drpcountry').change();
        }
    });
});

function bindSubmit() {

$('.contactmesubmit').click(function () {

    //alert('submit');

    var description = $('#description').val();
    var state = $('#state').val();
    var country = $('#country').val();
    var ProductInterestVal = [];
    var SolutionInterestVal = [];

    $('input:checkbox[name=SolutionInterest]:checked').each(function () {
        SolutionInterestVal.push($(this).val());
    });

    $('input:checkbox[name=ProductInterest]:checked').each(function () {
        ProductInterestVal.push($(this).val());
    });

    var SolutionInterest = SolutionInterestVal.toString();
    var ProductInterest = ProductInterestVal.toString();

    $.post('/magicactions.aspx?action=saveform', {
        _sendtoSF: 1,
        _tb: 'custom_contact',
        first_name: $('#first_name').val(),
        last_name: $('#last_name').val(),
        title: $('#title').val(),
        company: $('#company').val(),
        email: $('#email').val(),
        phone: $('#phone').val(),
        description: description,
        state: state,
        country: country,
        city: $('#city').val(),
        SelfIdentifier: $('#SelfIdentifier').val(),
        ProductInterest: ProductInterest,
        SolutionInterest: SolutionInterest,
        Industry: $('#Industry').val()
    });


    Boxy.get(this).hide();
    Boxy.load('/magicactions.aspx?action=loadlink&url=/lightbox/thankyou.html', { modal: true });

});

}
 
function FormatSlug(url)
    {
        url = '_' + url + '_';
        url = url.replace("_type_0_", "_").replace("_pid_0_", "_");
        url = url.replace("_type_0.", ".").replace("_pid_0.", ".");
        url = url.substr(1);
        url = url.substr(0, url.length - 1);
       
        return url;
    }


function Initfmsearchproduct() {
    if ($('.fmsearchproduct').length == 0) return;

    $('.fmsearchproduct').submit(function() {
        var params = {};
        $('.fmsearchproduct :input').each(function() {
        if(this.name.length>0)
            params[this.name] = $(this).val();

        });
        $('.finder_results').html('Loading ...');
        $.post('/searchproduct.aspx', params, function(data) {
            $('.finder_results').html(data);
        });
        return false;
    });
    
}


function ajax_link(obj) {
    if ($('.jqmWindow').length == 0) {
        $('body').append('<div class="jqmWindow"><a href="#" class="jqmClose">Close</a><hr /><div class="jqmContent"></div></div>');
    }

    $('.jqmWindow').jqm().jqmShow();
    $('.jqmContent').html('Loading ...');

    $.get('/magicactions.aspx?action=loadlink&url=' + $(obj).attr('href'), function(data) {
        $('.jqmContent').html(data);
    });

}

function Sleep(obj, iMinSecond) {
    if (window.eventList == null)
        window.eventList = new Array();
    var ind = -1;
    for (var i = 0; i < window.eventList.length; i++) {
        if (window.eventList[i] == null) {
            window.eventList[i] = obj;
            ind = i;
            break;
        }
    }
    if (ind == -1) {
        ind = window.eventList.length;
        window.eventList[ind] = obj;
    }
    setTimeout("GoOn(" + ind + ")", iMinSecond);
}
function GoOn(ind) {
    var obj = window.eventList[ind];
    window.eventList[ind] = null;
    if (obj.NextStep) obj.NextStep();
    else obj();
}  

function GetPageSize() {

  var scrW, scrH;

  if(window.innerHeight && window.scrollMaxY) {

    // Mozilla

    scrW = window.innerWidth + window.scrollMaxX;

    scrH = window.innerHeight + window.scrollMaxY;

  } else if(document.body.scrollHeight > document.body.offsetHeight){

    // all but IE Mac

    scrW = document.body.scrollWidth;

    scrH = document.body.scrollHeight;

  } else if(document.body) { // IE Mac

    scrW = document.body.offsetWidth;

    scrH = document.body.offsetHeight;

  }

  

  var winW, winH;

  if(window.innerHeight) { // all except IE

    winW = window.innerWidth;

    winH = window.innerHeight;

  } else if (document.documentElement 

    && document.documentElement.clientHeight) {

    // IE 6 Strict Mode

    winW = document.documentElement.clientWidth; 

    winH = document.documentElement.clientHeight;

  } else if (document.body) { // other

    winW = document.body.clientWidth;

    winH = document.body.clientHeight;

  }

  

  // for small pages with total size less then the viewport

  var pageW = (scrW<winW) ? winW : scrW;

  var pageH = (scrH<winH) ? winH : scrH;

  

  return {PageW:pageW, PageH:pageH, WinW:winW, WinH:winH};

}

function GetPageScroll() {

  var x, y;

  if(window.pageYOffset) {

    // all except IE

    y = window.pageYOffset;

    x = window.pageXOffset;

  } else if(document.documentElement 

    && document.documentElement.scrollTop) {

    // IE 6 Strict

    y = document.documentElement.scrollTop;

    x = document.documentElement.scrollLeft;

  } else if(document.body) {

    // all other IE

    y = document.body.scrollTop;

    x = document.body.scrollLeft; 

  }

  return {X:x, Y:y};

}

var flag =2;

function getLocations(){
	var t = $('.drplocation_type').val();
	var z = $('.drplocation_zip').val();
	
	if (t=="undefined" || t==undefined)
		t = "";
	if (z=="undefined" || z==undefined)
		z = "";
	
	var c = $('.drplocation_country option:selected').text();
	var s =$(".locsign").val();
	
	if (s=="undefined" || s==undefined)
		s = "";
		
	if (s=="OFFICE")
		$(".location_type_fm").hide();
	
	var sid = 1;
	if (jQuery(".locid:last").val() == undefined)
		sid = 1;
	else
		sid = Number("0"+jQuery(".locid:last").val());
		
	var dt = "action=getreseller&limit=75&sid="+sid+"&country="+c+"&type="+t+"&zip="+z + "&sign=" + s+"&nt="+(new Date().getTime());	

	$.ajax({
		   url:"/ajax.aspx",
		   data:dt,
		   type:"post",
		   dataType:"text",
		   success:function(res){
			jQuery(".ullocations").html(res);
			flag=1;
			if (res != "" && 1==2){
				//setTimeout(getLocations, 6000);
				
				$(".loadingmind").show();
				$(window).scroll(function(){
				  	//$(".loadingmind").text((GetPageSize().PageH - GetPageScroll().Y));
				  	if ((GetPageSize().PageH - GetPageScroll().Y)<1500){
						$(window).scroll(function(){});
						if (flag==1){
							flag = 2;
							getLocations();	
						}
						
					}
				  });
			}
			else
				$(".loadingmind").hide();
			}
							
		   });
}

function getTypesByCountry(){
	var c = $('.drplocation_country option:selected').text();
	
	$.ajax({
	   url:"/ajax.aspx",
	   data:"action=getresellertypes&country="+c+"&nt="+(new Date().getTime()),
	   type:"post",
	   dataType:"text",
	   success:function(res){
		var temp = "";
		var ares = res.split(',');
		for (var t in ares)
		{
			if(ares[t].length>0){
			temp = temp + "<option>" + ares[t] +"</option>";
			}
		}
	
		var html = ' <select class="drplocation_type" onchange="drplocation_type_zip_change()">'+('<option value="">--  All Types --</option>')+'' + temp + '</select>';
		$('.location_type_fm').html(html);
		getZipsByCountry();
	   }
	   
	   });
}

function getZipsByCountry(){
	var c = $('.drplocation_country option:selected').text();
	var s =$(".locsign").val();
	
	$.ajax({
	   url:"/ajax.aspx",
	   data:"action=getresellerzips&country="+c+"&sign="+s,
	   type:"post",
	   dataType:"text",
	   success:function(res){
		   				var temp = "";
						var ares = res.split(',');
		   				for (var t in ares)
						{
							if(ares[t].length>0){
							temp = temp + "<option>" + ares[t] +"</option>";
							}
						}
						var html = ' <select class="drplocation_zip" onchange="drplocation_type_zip_change()">'+('<option value="">--  All States/Provinces --</option>')+'' + temp + '</select>';
						$('.location_zip_fm').html(html);
						drplocation_type_zip_change();
		}
	   
	   });
}

function InitLocations() {
    if ($('.location_header').length == 0) return;
    var html = '<option value="">-- Select --</option>';
    $('.location_countries li').each(function() {
		if( $.trim($(this).html()).length>0){
        html += '<option>' + $(this).html() + '</option>';
		}
    });

    $('.location_header').html('Country: <select class="drplocation_country" onchange="drplocation_country_change()">' + html + '</select> <span class="location_type_fm"></span> <span class="location_zip_fm"></span><span class="loadingmind"></span>');

    //%%%
    var countryCode = document.location.host.replace('www.', '').replace('alliedtelesis', '').replace('com.', '').replace('.', '').replace('allied-', '').replace("magiclamp.net", '');
    if (countryCode == 'com' || countryCode == 'alliedmagiclamp.net') { countryCode = 'us'; }

    $.ajax({
        url: "/ajax.aspx",
        data: "action=getCountries",
        type: "post",
        dataType: "text",
        success: function (res) {
            $('.drplocation_country').html('<option value="">-- Select --</option>');
            var countries = res.split('###');
            $(countries).each(function () {
                if ($(this).length > 0) {
                    var countrySplit = this.split('-')
                    $('.drplocation_country').append('<option value="' + countrySplit[1].toLowerCase() + '">' + countrySplit[0] + '</option>');
                }
            });
            $('.drplocation_country option[value="' + countryCode + '"]').attr('selected', 'selected');
            drplocation_country_change_do();
        }
    });
}

function drplocation_country_change_do() {
    $('.location_type_fm').html('Loading ...');
	$('.location_zip_fm').html('Loading ...');
    setTimeout('drplocation_country_change()', 10);
}

function drplocation_country_change() {
    var c = $('.drplocation_country option:selected').text();
	
	getTypesByCountry();
}

function drplocation_type_zip_change(){
	var sid = 1;
	if (jQuery(".locid:last").val() == undefined)
		sid = 1;
	else
		sid = Number("0"+jQuery(".locid:last").val());

	$('.ullocations').html("");
	//$(".loadingmind").text("Data still loading..."+sid);
	$(".loadingmind").show();
	getLocations();
	
}


function InitValidations() {
    $('.validate').validate();
    $('#contactform').validate();
    $('#quickcontact').validate({
	rules: {
	    Phone: {required: false,minlength: 10},
	    first_name: {required: true,minlength: 2},
	    last_name: {required: true,minlength: 2},
	    country: {required: true},
	    Email: {required: true,email: true},
	    company: {required: true,minlength: 2}
	    
	}
    });
}


function ShowPages() {
    var html = '';
    
    var loc = location.href.toLowerCase();
    loc = loc.substr(loc.lastIndexOf('/') + 1);
    loc = loc.substr(0, loc.indexOf('.'));
    if (loc.length == 0) loc = 'default';

    var curi = -1;
    var len = jQuery('.ulpages_fm li').length;
    if (len == 0) {
        return;
    }

    var curli = jQuery('.ulpages_fm a[href*=/' + loc + '.]').parent();




    curi = jQuery('.ulpages_fm li').index(curli);
   // 

    if (jQuery('.ulpages_fm li').length > 0) {
        if (curi == -1) curi = 0;
      
        if (curi > 0) {
            html += '<li><a href="' + $('.ulpages_fm li').eq(curi - 1).find('a').attr('href') + '">Previous</a></li>';
        }
        html += '<li><strong>' + $('.ulpages_fm li').eq(curi).text() + '</strong></li>';
        if (curi < $('.ulpages_fm li').length - 1) {
            html += '<li><a href="' + $('.ulpages_fm li').eq(curi + 1).find('a').attr('href') + '">Next</a></li>';
        }
      
        var u = ( $('.ulpages_fm a:eq(0)').attr('href')+'.aspx').replace('.aspx.aspx','.aspx').replace('.aspx','_showall_true.aspx');
 
        html += '<li><a href="'+u+'">Show All</a></li>';
        $('.ulpages_fm ul').html(html);
        return;
    }

    jQuery(curli).html('<strong>' + jQuery(curli).text() + '</strong>');

    var padding = 3;
    var posb = curi - padding;
    var pose = curi + padding;

    if (posb <= 0) {
        pose = pose - posb + 1;

    }
    if (pose >= len - 1) {
        posb = posb - (pose - len) - 2;
    }

    for (var i = 0; i < len; i++) {
        if ((i >= posb && i <= pose) || i == 0 || i == len - 1) {
            jQuery('.ulpages_fm li').eq(i).addClass('s');
        }
    }
    jQuery('.ulpages_fm li[class!=s]').remove();

    if (len > (2 * padding) + 3) {
        if (curi > padding + 1) {
            jQuery('.ulpages_fm li:first').after('<li class="s">...</li>');
        }
        if (curi < len - padding - 1) {
            jQuery('.ulpages_fm li:last').before('<li class="s">...</li>');
        }
    }
    return;
}


function drpCountryChange(region) {
    var defaultemail = $('.txtemailnotify').val();
    if (region == "APAC") {
        defaultemail = "Net.Cover-APAC@alliedtelesis.com";
    }
    var c = $('.drpCountry').val();
    var t = defaultemail;

    //alert(c);

    switch (c) {
        case 'au':
            {
                t = 'net.cover@alliedtelesis.com.au';

                break;
            }
        case 'ru':
            {
                t += ',info@alliedtelesyn.ru';
                break;
            }
        case 'sg':
            {
                t += ',RMA-AsiaPacific@alliedtelesis.com.sg ';
                break;
            }
        case 'nz':
            {
                t += ',sales@alliedtelesis.net.nz,support@alliedtelesis.net.nz';
            }
        default:
            {
                if (t != null && t.indexOf('richard_lardner') == -1) {
                    t += ',Netcover_Europe@alliedtelesis.com,richard_lardner@alliedtelesis.com';
                }
                break;
            }
    }

    $('.txtemailnotify').val(t);
}

function InitFormFields() {
    if ($('.autofields').length > 0) {
        if ($('.autofields input[name=_fieldOrder]').length == 0) {
            var fields = ',';
            //alert($('.autofields :input').length);
            $('.autofields :input').each(function(i) {
                var fname = $('.autofields :input').eq(i).attr('name');
                if (fname) {
                    if (fname.substr(0, 1) != '_' && fields.indexOf(',' + fname + ',') == -1 && (',form_redirect,submit,submitbutton,FORM_ID,NEXT_PAGE,').indexOf(',' + fname + ',') == -1) {
                        fields = fields + fname + ',';
                    }
                }
            });
            fields = fields.substr(1);
            if (fields.substr(fields.length - 1) == ',') {
                fields = fields.substr(0, fields.length - 1);
            }

            $('.autofields').append('<input type="hidden" name="_fieldOrder" value="' + fields + '" /> ');

        }
    }
}

function fillStates(){
	var sStates = '';
	
	if ($('#country').val() != "us" && $('#country').val() != "ca"){
	    $('#state.fillme').html('');
	    $('#stateDiv').hide();
	}
	
	if ($('#country').val() == "us") {
	    sStates = sStates + '<option value="">Please Select...</option>'
	    sStates = sStates + '<option value="AL">AL</option>'
	    sStates = sStates + '<option value="AK">AK</option>'
	    sStates = sStates + '<option value="AZ">AZ</option>'
	    sStates = sStates + '<option value="AR">AR</option>'
	    sStates = sStates + '<option value="CA">CA</option>'
	    sStates = sStates + '<option value="CO">CO</option>'
	    sStates = sStates + '<option value="CT">CT</option>'
	    sStates = sStates + '<option value="DE">DE</option>'
	    sStates = sStates + '<option value="DC">DC</option>'
	    sStates = sStates + '<option value="FL">FL</option>'
	    sStates = sStates + '<option value="GA">GA</option>'
	    sStates = sStates + '<option value="HI">HI</option>'
	    sStates = sStates + '<option value="ID">ID</option>'
	    sStates = sStates + '<option value="IL">IL</option>'
	    sStates = sStates + '<option value="IN">IN</option>'
	    sStates = sStates + '<option value="IA">IA</option>'
	    sStates = sStates + '<option value="KS">KS</option>'
	    sStates = sStates + '<option value="KY">KY</option>'
	    sStates = sStates + '<option value="LA">LA</option>'
	    sStates = sStates + '<option value="ME">ME</option>'
	    sStates = sStates + '<option value="MD">MD</option>'
	    sStates = sStates + '<option value="MA">MA</option>'
	    sStates = sStates + '<option value="MI">MI</option>'
	    sStates = sStates + '<option value="MN">MN</option>'
	    sStates = sStates + '<option value="MS">MS</option>'
	    sStates = sStates + '<option value="MO">MO</option>'
	    sStates = sStates + '<option value="MT">MT</option>'
	    sStates = sStates + '<option value="NE">NE</option>'
	    sStates = sStates + '<option value="NV">NV</option>'
	    sStates = sStates + '<option value="NH">NH</option>'
	    sStates = sStates + '<option value="NJ">NJ</option>'
	    sStates = sStates + '<option value="NM">NM</option>'
	    sStates = sStates + '<option value="NY">NY</option>'
	    sStates = sStates + '<option value="NC">NC</option>'
	    sStates = sStates + '<option value="ND">ND</option>'
	    sStates = sStates + '<option value="OH">OH</option>'
	    sStates = sStates + '<option value="OK">OK</option>'
	    sStates = sStates + '<option value="OR">OR</option>'
	    sStates = sStates + '<option value="PA">PA</option>'
	    sStates = sStates + '<option value="RI">RI</option>'
	    sStates = sStates + '<option value="SC">SC</option>'
	    sStates = sStates + '<option value="SD">SD</option>'
	    sStates = sStates + '<option value="TN">TN</option>'
	    sStates = sStates + '<option value="TX">TX</option>'
	    sStates = sStates + '<option value="UT">UT</option>'
	    sStates = sStates + '<option value="VT">VT</option>'
	    sStates = sStates + '<option value="VA">VA</option>'
	    sStates = sStates + '<option value="WA">WA</option>'
	    sStates = sStates + '<option value="WV">WV</option>'
	    sStates = sStates + '<option value="WI">WI</option>'
	    sStates = sStates + '<option value="WY">WY</option>'
	    sStates = sStates + '<option value="AS">AS</option>'
	    sStates = sStates + '<option value="GU">GU</option>'
	    sStates = sStates + '<option value="MP">MP</option>'
	    sStates = sStates + '<option value="PR">PR</option>'
	    sStates = sStates + '<option value="VI">VI</option>'
	    $('#state.fillme').html(sStates);
	    $('#stateDiv').show();
	}
	if ($('#country').val() == "ca") {
	    sStates = sStates + '<option value="">Please Select...</option>'
	    sStates = sStates + '<option value="Alberta">Alberta</option>'
	    sStates = sStates + '<option value="British Columbia">British Columbia</option>'
	    sStates = sStates + '<option value="Manitoba">Manitoba</option>'
	    sStates = sStates + '<option value="New Brunswick">New Brunswick</option>'
	    sStates = sStates + '<option value="Newfoundland and Labrador">Newfoundland and Labrador</option>'
	    sStates = sStates + '<option value="Northwest Territories">Northwest Territories</option>'
	    sStates = sStates + '<option value="Nova Scotia">Nova Scotia</option>'
	    sStates = sStates + '<option value="Nunavut">Nunavut</option>'
	    sStates = sStates + '<option value="Ontario">Ontario</option>'
	    sStates = sStates + '<option value="Prince Edward Island">Prince Edward Island</option>'
	    sStates = sStates + '<option value="Quebec">Quebec</option>'
	    sStates = sStates + '<option value="Saskatchewan">Saskatchewan</option>'
	    sStates = sStates + '<option value="Yukon">Yukon</option>'
	    $('#state.fillme').html(sStates);
	    $('#stateDiv').show();
	}
        
}
