function ShowTab(T){if(TabSize != null){maxSize = TabSize + 1;} else {maxSize = 7;}for(i = 1; i < maxSize; i++){document.getElementById("div" + i).style.display = "none";document.getElementById("tab" + i).className = "";}document.getElementById("div" + T).style.display = "";document.getElementById("tab" + T).className = "active";}
function myPopup2(linkURL,wid,hght,mytitle) {GB_show(mytitle,linkURL,hght,wid);return false;}
function makeactive(tab){document.getElementById("tab1").className = "tab";document.getElementById("tab2").className = "tab";document.getElementById("tab3").className = "tab";document.getElementById("tab"+tab).className = "tab selected";}
function SelectOptions(id){var rel = document.getElementById(id);for (i=0; i < rel.options.length; i++) {rel.options[i].selected = true;}}
function hidediv(id) {if (document.getElementById){document.getElementById(id).style.display = 'none';}else{if(document.layers){document.id.display = 'none';}else{document.all.id.style.display = 'none';}}}
function showdiv(id) {if (document.getElementById){document.getElementById(id).style.display = 'block';}else{if (document.layers){document.id.display = 'block';}else{document.all.id.style.display = 'block';}}}
function MM_jumpMenu(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if (restore) selObj.selectedIndex=0;}
function CheckUncheckAll(frm) {var form = document.getElementById(frm);count = form.elements.length;for (i=0; i < count; i++){if(form.elements[i].checked == 1){form.elements[i].checked = 0;}else {form.elements[i].checked = 1;}}}
function mark_options(id,s){var t = document.getElementById(id);if (!t){return;}var rb = t.getElementsByTagName('input');for (var r = 0; r < rb.length; r++){if (rb[r].id.substr(rb[r].id.length-1) == s){rb[r].checked = true;}}}
function neonixToggle(itemID,linkID,anchorID,tSwitch){if (document.getElementById && navigator.userAgent.indexOf('Opera') == -1){var itemEL = document.getElementById(itemID);var linkEL = document.getElementById(linkID);itemEL.className = itemEL.className == 'TG_visible' ? 'TG_hidden':'TG_visible';}if (anchorID.length != 0){;document.location.href = '#' + anchorID;}}
if (document.getElementById && navigator.userAgent.indexOf('Opera') == -1){document.writeln('<style type="text/css">');document.writeln('.TG_visible {display: normal;}');document.writeln('.TG_hidden {display: none;}');document.writeln('</style>');}
function download_customized(form,site_url,link_id) {
	jQuery('#' + link_id).slideUp("slow");
	showUpdate();
	var req =  jQuery.ajax({
		type: "POST",
		url: site_url,
		data: jQuery('#' + form).serialize(),
		success: function(html){
			jQuery('#file').attr({ value: html });
			jQuery('#super_form').submit();
                        jQuery('#' + link_id).slideDown("slow");
			hideUpdate();
		}
	});
	return false;
}
function ajax_form(form,site_url,link_id){
	jQuery('#' + link_id).slideUp("slow");
	showUpdate();
	jQuery.post
	( 
		site_url, 
		jQuery('#' + form).serialize(), 
		function(html){
			jQuery('#' + link_id).html(html);
			jQuery('#' + link_id).slideDown("slow");
			hideUpdate();
		}
	);
}
function ajax_paginate(c_url,link_id){showUpdate();jQuery('#' + link_id).load("" + c_url + "", hideUpdate);}
function adult_confirm(c_url,link_id){jQuery('#' + link_id).load("" + c_url + "", self.parent.tb_remove);}
function add_class(el_id,new_class){return jQuery('#' + el_id).addClass(new_class);}
function remove_class(el_id,new_class){return jQuery('#' + el_id).removeClass(new_class);}
function showUpdate(){
	if (typeof document.body.style.maxHeight === "undefined") {
		jQuery("body","html").css({height: "100%", width: "100%"});
		jQuery("html").css("overflow","hidden");
		if (document.getElementById("TB_HideSelect") === null) {
			jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
		}
	}else{
		if(document.getElementById("TB_overlay") === null){
			jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
		}
	}
	if(tb_detectMacXFF()){
		jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");
	}else{
		jQuery("#TB_overlay").addClass("TB_overlayBG");
	}
	jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");
	jQuery('#TB_load').show();
}
function hideUpdate(){tb_remove();}
function filterNonNumeric(field) {
	var result = new String();
	var numbers = "0123456789";
	var chars = field.value.split(""); // create array 
	for (i = 0; i < chars.length; i++) {
	if (numbers.indexOf(chars[i]) != -1) result += chars[i];
	}
	if (field.value != result) field.value = result;
}
Array.prototype.count = function(){return this.length;};
function jquery_slide_down(el_id){jQuery('#' + el_id).slideDown("slow");}
function jquery_slide_up(el_id){jQuery('#' + el_id).slideUp("slow");}

jQuery.fn.shake = function(intShakes,intDistance,intDuration) {
  this.each(function() {
    jQuery(this).css({position:'relative'});
    for (var x=1; x<=intShakes; x++) {
      jQuery(this).animate({left:(intDistance*-1)}, (((intDuration/intShakes)/4)))
      .animate({left:intDistance}, ((intDuration/intShakes)/2))
      .animate({left:0}, (((intDuration/intShakes)/4)));
    }
  });
  return this;
};

jQuery(document).ready(function(){
	show_adult_alert();
	jQuery("#search_input").typeWatch( { highlight:true, callback: function () {ajax_form('search_form',base_url + '/search/show_results','search_results');} } );
	if (jQuery("li").hasClass("picture_wrapper")) {jQuery(".picture_wrapper").click(function(){jQuery(this).shake(2, 4, 200);});	}
});
function show_adult_alert()
{
	if(adult_check==true)
	{
		tb_show('Age verification',base_url+'generic_messages/age_verification?KeepThis=true&height=140&width=550&modal=true', null);
	}
}
jQuery(function(){jQuery('.tooltip').tooltip({track: true,delay: 2,showURL: false,showBody: " - "});
jQuery('.img_tooltip').tooltip({delay: 0,track: true,showURL: false,bodyHandler: function() {	return jQuery("<img/>").attr("src", this.rel);}});});