function XmlHttp(){}

XmlHttp.getAvailableActiveX = function(){
	if(XmlHttp.availableActiveX)
		return XmlHttp.availableActiveX;

	var ids = ["MSXML4.XmlHttp", 
			   "MSXML3.XmlHttp",
			   "MSXML2.XmlHttp", 
			   "MSXML.XmlHttp",
			   "Microsoft.XmlHttp"];

	for(var i=0; i<ids.length; i++){ 
		try{
			var obj = new ActiveXObject(ids[i]);
			XmlHttp.availableActiveX = ids[i];
			return ids[i];
		} 
		catch(ex){
			xmlhttp = false; 
		}
	}
	throw new Exception('XmlHttp objects not supported by the browser');
}

XmlHttp.create = function(){
	try{
		if(window.ActiveXObject){
			return new ActiveXObject(XmlHttp.getAvailableActiveX());
		}
		else if (window.XMLHttpRequest){
			var r = new XMLHttpRequest();

			// para alguna versiones de Mozilla que no disponen de readyState y onReadyState
			if(r.readyState == null){
				r.readyState = 1;
				r.addEventListener('load', function(){
					r.readyState = 4;
					if(typeof(r.onreadystatechange)=='function')
						r.onreadystatechange();
				}, false);
			}
			return r;
		}
	}
	catch (ex) {}
	throw new Error('XmlHttp objects not supported by the browser');
}

function ChangeVisibilityById(id)
{
	var display = document.getElementById(id).style.display;
	
	if( display == 'block' )
	{
		document.getElementById(id).style.display='none';
	}
	else
	{
		document.getElementById(id).style.display='block';
	}
}

function loadPart(frameid, siteid)
{
	var req = XmlHttp.create();
	if(req)
	{
		req.open('GET', 'ajaxload.php?section=' + frameid + '&id=' + siteid, false);
		req.send(null);
		document.getElementById('content').innerHTML=req.responseText;
		jQuery("#content a[rel^='lightbox']").slimbox(); 
	}
}

function orderShowShipmentConditions()
{
	document.getElementById('orderShipmentConditionBG').style.visibility='visible';
	document.getElementById('orderShipmentCondition').style.visibility='visible';
}

function orderHideShipmentConditions()
{
	document.getElementById('orderShipmentCondition').style.visibility='hidden';
	document.getElementById('orderShipmentConditionBG').style.visibility='hidden';
}

function showWinePicture()
{
	document.getElementById('winePictureBG').style.visibility='visible';
	document.getElementById('winePicture').style.visibility='visible';
}

function hideWinePicture()
{
	document.getElementById('winePicture').style.visibility='hidden';
	document.getElementById('winePictureBG').style.visibility='hidden';
}

function showGlobalPicture(fname)
{
	document.getElementById('GlobalPicture').innerHTML='<img onClick="javascript:hideGlobalPicture();" src="./pictures/'+fname+'"/>';
	document.getElementById('GlobalPictureBG').style.visibility='visible';
	document.getElementById('GlobalPicture').style.visibility='visible';
}

function hideGlobalPicture()
{
	document.getElementById('GlobalPicture').style.visibility='hidden';
	document.getElementById('GlobalPictureBG').style.visibility='hidden';
	document.getElementById('GlobalPicture').innerHTML='';
}
