function SetRegion(form){
	javascript:window.location.href='http://www.weddingwarehouse.com/index.php?regionId=' + form.lstRegions[form.lstRegions.selectedIndex].value;
}

function SetCategoryRegion(form,categoryId){
	javascript:window.location.href='http://www.weddingwarehouse.com/category.php?id=' + categoryId + '&regionId=' + form.lstRegions[form.lstRegions.selectedIndex].value;
}

function GoToCategory(form,regionId){
	if(form.lstCategories.selectedIndex==0){
		alert('Please select a category');
	}else{
		javascript:window.location.href='http://www.weddingwarehouse.com/category.php?id=' + form.lstCategories[form.lstCategories.selectedIndex].value + '&regionId=' + regionId;
	}
}

function OpenWindow(desktopURL) {var desktop = window.open( desktopURL,"_blank","toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=700,height=550,left=0,top=0" );}

function compareText (option1, option2) {
  return option1.text < option2.text ? -1 :
    option1.text > option2.text ? 1 : 0;
}

function compareValue (option1, option2) {
  return option1.value < option2.value ? -1 :
    option1.value > option2.value ? 1 : 0;
}

function compareTextAsFloat (option1, option2) {
  var value1 = parseFloat(option1.text);
  var value2 = parseFloat(option2.text);
  return value1 < value2 ? -1 :
    value1 > value2 ? 1 : 0;
}

function compareValueAsFloat (option1, option2) {
  var value1 = parseFloat(option1.value);
  var value2 = parseFloat(option2.value);
  return value1 < value2 ? -1 :
    value1 > value2 ? 1 : 0;
}

function sortSelect (select, compareFunction) {
  if (!compareFunction)
    compareFunction = compareText;
  var options = new Array (select.options.length);
  for (var i = 1; i < options.length; i++)
    options[i] = 
      new Option (
        select.options[i].text,
        select.options[i].value,
        select.options[i].defaultSelected,
        select.options[i].selected
      );
  options.sort(compareFunction);
  options[0] = 
      new Option (
        select.options[0].text,
        select.options[0].value,
        select.options[0].defaultSelected,
        select.options[0].selected
      );
  select.options.length = 0;
  var iLength = options.length - 1;
  for (var i = 0; i < iLength; i++){
    select.options[i] = options[i];
  }
}
