function Navigate() {
  var number = document.getElementById('Licenses').selectedIndex;
  location.href = document.getElementById('Licenses').options[number].value; 
}

$(document).ready(function(){
  // get gallery images
  $('#gallery-dd').change(function() {
    $('#gallery #featured').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16'  />");
    $('#gallery #gallerynav ol').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    $('#gallery #gallerydetails h2').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    $('#gallery #gallerydetails p').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    $('#gallery #garmentdetails p').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    setTimeout(getGalleryInfo, 800);        
  });
  
  // news internal nav
  $('#internal-feed .feednav a').live('click', function() {
    var pageNo = $(this).attr("href");
    $('.left #newsfeed').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    setTimeout(function(){displayInternalNews(pageNo)}, 800);        
  });
  
  // news internal nav
  $('#news-feed .feednav a').live('click', function() {
    var pageNo = $(this).attr("href");
    $('.left #newsfeed').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    setTimeout(function(){displayNewsFeed(pageNo)}, 800);        
  });
  
  // news internal nav
  $('#jobs-feed .feednav a').live('click', function() {
    var pageNo = $(this).attr("href");
    $('.left #newsfeed').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    setTimeout(function(){displayJobFeed(pageNo)}, 800);        
  });
  
  // display large gallery image
  /*$('#gallerynav ol li a').live('click', function() {
    var imgName = $(this).attr("id");
    $('#featured').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16'  />");
    setTimeout(function(){displayGalleryLargeImage(imgName)}, 800);        
  });*/

  // get jobs by city
  $('#job-dd').change(function() {
    var pageNo = $(this).attr("href");
    $('#newsfeed').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    setTimeout(jobListCity(), 800);        
  });
  
  // get newsfeed by month - internal
  $('#monthInt-dd').change(function() {
    var pageNo = $(this).attr("href");
    $('#newsfeed').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    setTimeout(internalfeedMonth, 800);        
  });
  
  // get newsfeed by month - news
  $('#monthNews-dd').change(function() {
    $('#newsfeed').html("<img src='http://www.evy.com/_img/ajax-loader.gif' width='16' height='16' style='position:relative;top:50%;left:50%;' />");
    setTimeout(newsfeedMonth, 800);        
  });
  
  function getGalleryInfo() {    
    window.location.href = "" + $('#gallery-dd').val() + "" 
  }
  
  var galleryID = ''; 
  function displayGalleryLargeImage(imgName) {
    $.ajax({
      url: '/common.php?type=getGID&iid=' + imgName,
      success: function(data) {
        galleryID = data;          
      }
    });
    
    $.ajax({
      url: '/common.php?type=getGImage&iid=' + imgName,
      success: function(data) { 
        $('#featured').html('<a href="http://www.evy.com/gimage/'+galleryID+'/'+imgName+'" target="_blank"><img src="http://www.evy.com/images/gallery/'+ galleryID +'/'+ data +'?m=scale&w=470&h=350" /></a>').fadeIn(1500);        
      }
    });        
    
    $.ajax({
      url: '/common.php?type=text&iid=' + imgName,
      success: function(data) {
        $('#garmentdetails p').html(data);
      }
    });
  }
  
  function galleryImages() {
    $.ajax({
      url: '/common.php?gid=' + $('#gallery-dd').val(),
      success: function(data) {
        //$('#newsfeed').html(data);
      }
    });
  } // end function
  
  function jobListCity() {
    $.ajax({
      url: 'common.php?city=' + $('#job-dd').val() + '&type=c&page=1',
      success: function(data) {
        $('#newsfeed').html(data);
      }
    });
    $.ajax({
      url: 'common.php?content=jobs&type=n&page=1&city=' + $('#job-dd').val(),
      success: function(data) {        
        $('.left .feednav').html(data);
      }
    });
  } // end function

  function displayJobFeed(pageNo) {
    $.ajax({
      url: 'common.php?city=' + $('#job-dd').val() + '&type=c&page=' + pageNo.replace("#", ""),
      success: function(data) {
        $('#newsfeed').html(data);
      }
    });
    $.ajax({
      url: 'common.php?content=jobs&type=n&page='+ pageNo.replace("#", "") + '&city=' + $('#job-dd').val(),
      success: function(data) {        
        $('.left .feednav').html(data);
      }
    });
  } // end function
   
  function newsfeedMonth() {
    $.ajax({
      url: 'common.php?type=news&month=' + $('#monthNews-dd').val(),
      success: function(data) {
        $('#newsfeed').html(data);
      }
    });

    $.ajax({
      url: 'common.php?content=news&type=n&page=1&month=' + $('#monthNews-dd').val(),
      success: function(data) {        
        $('.left .feednav').html(data);
      }
    });
  } // end function

  function internalfeedMonth() {
    $.ajax({
      url: 'common.php?type=internal&month=' + $('#monthInt-dd').val(),
      success: function(data) {
        $('#newsfeed').html(data);
      }
    });
    
    $.ajax({
      url: 'common.php?content=internal&type=n&page=1&month=' + $('#monthInt-dd').val(),
      success: function(data) {
        $('.left .feednav').html(data);
      }
    });
  } // end function
  
  function displayInternalNews(pageNo) {      
    $.ajax({
      url: 'common.php?content=internal&type=c&page=' + pageNo.replace("#", "") + '&month=' + $('#monthInt-dd').val(),
      success: function(data) {
        $('.left #newsfeed').html(data);
      }
    });
    
    $.ajax({
      url: 'common.php?content=internal&type=n&page=' + pageNo.replace("#", "") + '&month=' + $('#monthInt-dd').val(),
      success: function(data) {
        $('.left .feednav').html(data);
      }
    });
  }
  
  function displayNewsFeed(pageNo) {      
    $.ajax({
      url: 'common.php?content=news&type=c&page=' + pageNo.replace("#", "") + '&month=' + $('#monthNews-dd').val(),
      success: function(data) {
        $('.left #newsfeed').html(data);
      }
    });
    
    $.ajax({      
      url: 'common.php?content=news&type=n&page=' + pageNo.replace("#", "") + '&month=' + $('#monthNews-dd').val(),
      success: function(data) {
        $('.left .feednav').html(data);
      }
    });
  }    
  
  /**** preloader ****/ 
  $('img').load(function() {    
    $('img').fadeIn(1500);
  });
  
  var oSlider = $('#gallerynav');
	if(oSlider.length > 0){
		oSlider.tinycarousel({ display: 5, rewind: true, start:1 });
	}
       
});
