
$(document).ready(function() { 


$('.forms1').popupWindow({
height:500, 
width:800,
centerBrowser:1 
});





		$("a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'fast', /* fast/slow/normal */
			padding: 40, /* padding for each side of the picture */
			opacity: 0.02, /* Value betwee 0 and 1 */
			showTitle: true, /* true/false */
			allowresize: false, /* true/false */
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'dark_square' /* light_rounded / dark_rounded / light_square / dark_square */
		});
	


	$("#ad_button").slideDown("slow");
    $("#ad_button").click(function(){
	$("#ad_button").slideUp("medium");		
	return false;
	});

 


   $("#stool").click(function () {
      if ($("#content_top:first").is(":hidden")) {
			$("#content_top").slideDown("slow");	
			 
      } else {
		  
		$("#content_top").slideUp("slow");       
		return false;
		
      }						
    });




   $("#cform").click(function () {

      if ($("#hidform:first").is(":hidden")) {
		  $("#hidform").slideDown("slow");
			
			 
      } else {		
		$("#hidform").slideUp("slow"); 	
		return false;
      }						
    });



	   $("#cform_close").click(function () {	
		  if ($("#hidform:first").is(":visible")) {
		  $("#hidform").slideUp("slow");
			
			 
      } else {	  

		$("#hidform").slideDown("slow"); 	
		return false;
	   }				
    });

	









});	




var xmlHttp

function jax(id ,value ){ 

	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) { alert ("Browser does not support HTTP Request")
	return 
	}		

	

	var url="ajax.php";
	

	url=url+"?"+id+"="+value

	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
	}

function stateChanged(){ if (xmlHttp.readyState==4 || xmlHttp.readyState== "200") {		
		
		var setId = String("inventory_results");
		document.getElementById(setId).innerHTML=xmlHttp.responseText } 
		}

function GetXmlHttpObject(){var xmlHttp=null;
	try {
	// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){
	//Internet Explorer
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e)  {
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	}
	
	return xmlHttp;

	}



var xmlHttp2

function jax_search(id ,value ){ 
	
	
	xmlHttp2=GetXmlHttpObject()
	if (xmlHttp2==null) { alert ("Browser does not support HTTP Request")
	return 
	}			

	var url="ajax.php";

	

	url=url+"?"+id+"="+value

	xmlHttp2.onreadystatechange=stateChanged2
	xmlHttp2.open("GET",url,true)
	xmlHttp2.send(null)
	
	}

function stateChanged2(){ if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete") {		
		
		var setId = String("search");
		document.getElementById(setId).innerHTML=xmlHttp2.responseText } 
		}

function GetXmlHttpObject(){var xmlHttp2=null;
	try {
	// Firefox, Opera 8.0+, Safari
		xmlHttp2=new XMLHttpRequest();
	}
	catch (e){
	//Internet Explorer
	try{
		xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e)  {
		xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	}
	
	return xmlHttp2;

	}


var xmlHttp3

function jax_glob(id ,value ){ 

	alert(id+value);
	xmlHttp3=GetXmlHttpObject()
	if (xmlHttp3==null) { alert ("Browser does not support HTTP Request")
	return 
	}		

	

	var url="global_ajax.php";
	

	url=url+"?"+id+"="+value

	xmlHttp3.onreadystatechange=stateChanged
	xmlHttp3.open("GET",url,true)
	xmlHttp3.send(null)
	
	}

function stateChanged(){ if (xmlHttp3.readyState==4 || xmlHttp3.readyState== "200") {		
		
		var setId = String("form_inv_left");
		document.getElementById(setId).innerHTML=xmlHttp3.responseText } 
		}

function GetXmlHttpObject(){var xmlHttp3=null;
	try {
	// Firefox, Opera 8.0+, Safari
		xmlHttp3=new XMLHttpRequest();
	}
	catch (e){
	//Internet Explorer
	try{
		xmlHttp3=new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e)  {
		xmlHttp3=new ActiveXObject("Microsoft.XMLHTTP");
	}
	}
	
	return xmlHttp3;

	}


(function($){ 		  
	$.fn.popupWindow = function(instanceSettings){
		
		return this.each(function(){
		
		$(this).click(function(){
		
		$.fn.popupWindow.defaultSettings = {
			centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
			centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left
			height:500, // sets the height in pixels of the window.
			left:0, // left position when the window appears.
			location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
			menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
			resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
			scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
			status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
			width:500, // sets the width in pixels of the window.
			windowName:null, // name of window set from the name attribute of the element that invokes the click
			windowURL:null, // url used for the popup
			top:0, // top position when the window appears.
			toolbar:0 // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
		};
		
		settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
		
		var windowFeatures =    'height=' + settings.height +
								',width=' + settings.width +
								',toolbar=' + settings.toolbar +
								',scrollbars=' + settings.scrollbars +
								',status=' + settings.status + 
								',resizable=' + settings.resizable +
								',location=' + settings.location +
								',menuBar=' + settings.menubar;

				settings.windowName = this.name || settings.windowName;
				settings.windowURL = this.href || settings.windowURL;
				var centeredY,centeredX;
			
				if(settings.centerBrowser){
						
					if ($.browser.msie) {//hacked together for IE browsers
						centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));
						centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));
					}else{
						centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));
						centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));
					}
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
				}else if(settings.centerScreen){
					centeredY = (screen.height - settings.height)/2;
					centeredX = (screen.width - settings.width)/2;
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
				}else{
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top).focus();	
				}
				return false;
			});
			
		});	
	};
})(jQuery);

