var customskin = {
	init: function() {
		customskin.homeselect();
		customskin.galleryselect();
		customskin.displayselect();
		customskin.mediaselect();
		customskin.sortselect();
		customskin.showselect();
	},
	
	homeselect: function() {
		if ($('.home-select').length > 0) {
			$('.home-select').each(function(i) {
	        	selectContainer = $(this);
	        	// Remove the class for non JS browsers
	        	//selectContainer.removeClass('my-skinnable-select');
	        	// Add the class for JS Browers
	        	selectContainer.addClass('skinned-select');
	        	// Find the select box
	        	selectContainer.children().before('<div class="select-text">a</div>').each(function() {
		            $(this).prev().text(this.options[0].innerHTML)
	          	});
	        	// Store the parent object
	        	var parentTextObj = selectContainer.children().prev();
	        	// As we click on the options
	        	selectContainer.children().click(function() {
	          		// Set the value of the html
	          		parentTextObj.text(this.options[this.selectedIndex].innerHTML);
	        	})        
      		});
		}
	},
	
	galleryselect: function() {
		if ($('.gallery-select').length > 0) {
			$('.gallery-select').each(function(i) {
	        	selectContainer = $(this);
	        	// Remove the class for non JS browsers
	        	//selectContainer.removeClass('my-skinnable-select');
	        	// Add the class for JS Browers
	        	selectContainer.addClass('skinned-select');
	        	// Find the select box
	        	selectContainer.children().before('<div class="select-text">a</div>').each(function() {
		            $(this).prev().text(this.options[0].innerHTML)
	          	});
	        	// Store the parent object
	        	var parentTextObj = selectContainer.children().prev();
	        	// As we click on the options
	        	selectContainer.children().click(function() {
	          		// Set the value of the html
	          		parentTextObj.text(this.options[this.selectedIndex].innerHTML);
	        	})        
      		});
		}
	},
	
	displayselect: function() {
		if ($('.select-display').length > 0) {
			$('.select-display').each(function(i) {
	        	selectContainer = $(this);
	        	// Remove the class for non JS browsers
	        	//selectContainer.removeClass('my-skinnable-select');
	        	// Add the class for JS Browers
	        	selectContainer.addClass('skinned-select');
	        	// Find the select box
	        	selectContainer.children().before('<div class="select-text">a</div>').each(function() {
		            $(this).prev().text(this.options[0].innerHTML)
	          	});
	        	// Store the parent object
	        	var parentTextObj = selectContainer.children().prev();
	        	// As we click on the options
	        	selectContainer.children().click(function() {
	          		// Set the value of the html
	          		parentTextObj.text(this.options[this.selectedIndex].innerHTML);
	        	})        
      		});
		}
	},
	
	mediaselect: function() {
		if ($('.select-media').length > 0) {
			$('.select-media').each(function(i) {
	        	selectContainer = $(this);
	        	// Remove the class for non JS browsers
	        	//selectContainer.removeClass('my-skinnable-select');
	        	// Add the class for JS Browers
	        	selectContainer.addClass('skinned-select');
	        	// Find the select box
	        	selectContainer.children().before('<div class="select-text">a</div>').each(function() {
		            $(this).prev().text(this.options[0].innerHTML)
	          	});
	        	// Store the parent object
	        	var parentTextObj = selectContainer.children().prev();
	        	// As we click on the options
	        	selectContainer.children().click(function() {
	          		// Set the value of the html
	          		parentTextObj.text(this.options[this.selectedIndex].innerHTML);
	        	})        
      		});
		}
	},
	
	sortselect: function() {
		if ($('.select-sort').length > 0) {
			$('.select-sort').each(function(i) {
	        	selectContainer = $(this);
	        	// Remove the class for non JS browsers
	        	//selectContainer.removeClass('my-skinnable-select');
	        	// Add the class for JS Browers
	        	selectContainer.addClass('skinned-select');
	        	// Find the select box
	        	selectContainer.children().before('<div class="select-text">a</div>').each(function() {
		            $(this).prev().text(this.options[0].innerHTML)
	          	});
	        	// Store the parent object
	        	var parentTextObj = selectContainer.children().prev();
	        	// As we click on the options
	        	selectContainer.children().click(function() {
	          		// Set the value of the html
	          		parentTextObj.text(this.options[this.selectedIndex].innerHTML);
	        	})        
      		});
		}
	},
	
	showselect: function() {
		if ($('.select-show').length > 0) {
			$('.select-show').each(function(i) {
	        	selectContainer = $(this);
	        	// Remove the class for non JS browsers
	        	//selectContainer.removeClass('my-skinnable-select');
	        	// Add the class for JS Browers
	        	selectContainer.addClass('skinned-select');
	        	// Find the select box
	        	selectContainer.children().before('<div class="select-text">a</div>').each(function() {
		            $(this).prev().text(this.options[0].innerHTML)
	          	});
	        	// Store the parent object
	        	var parentTextObj = selectContainer.children().prev();
	        	// As we click on the options
	        	selectContainer.children().click(function() {
	          		// Set the value of the html
	          		parentTextObj.text(this.options[this.selectedIndex].innerHTML);
	        	})        
      		});
		}
	}	
}

$(document).ready(function() {
  	customskin.init();
});

