var xmlHttp



function loadXML(xmlFile)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var url = xmlFile +"?sid="+Math.random();
	xmlHttp.onreadystatechange=onLoaded;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function onLoaded() 
{ 
	
	if (xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200 && xmlHttp.responseXML.documentElement != null)
		{
			setItems(xmlHttp.responseXML.documentElement.getElementsByTagName("items"));
			setGroup(xmlHttp.responseXML.documentElement.getElementsByTagName("group"));
			if(statusShow=="popula"){
				showFishRandomFirstPage();
			}else if(statusShow=="showRoom"){
				showFishAllRoom("showroom",1,1);
				setPage("showroom");
			}else if(statusShow=="hotStuff"){
				showFishAllRoom("hotstuff",1,1);
				setPage("hotstuff");
			}
			showFishNew();
			showFishPopula();
		}
	}
}

function setGroup(xmlDoc)
{
	;
	
	var itemNew_		=  (xmlDoc[0].getElementsByTagName("new")[0].firstChild==null) ? "" :xmlDoc[0].getElementsByTagName("new")[0].firstChild.nodeValue;
	var itemShowRoom_	=  (xmlDoc[0].getElementsByTagName("showroom")[0].firstChild==null) ? "" : xmlDoc[0].getElementsByTagName("showroom")[0].firstChild.nodeValue
	var itemHotStuff_	=  (xmlDoc[0].getElementsByTagName("hotstuff")[0].firstChild==null) ? "" :xmlDoc[0].getElementsByTagName("hotstuff")[0].firstChild.nodeValue;
	var itemPopula_		=  (xmlDoc[0].getElementsByTagName("popula")[0].firstChild==null) ? "" :xmlDoc[0].getElementsByTagName("popula")[0].firstChild.nodeValue;

	itemPopula = itemPopula_.split(",");
	itemNew = itemNew_.split(",");
	itemShowroom.push({countPage:xmlDoc[0].getElementsByTagName("showroom")[0].attributes.getNamedItem('countPage').value,items:itemShowRoom_.split(","),allFishData:xmlDoc[0].getElementsByTagName("showroom")[0].attributes.getNamedItem('allFishData').value});
	itemHotStuff.push({countPage:xmlDoc[0].getElementsByTagName("hotstuff")[0].attributes.getNamedItem('countPage').value,items:itemHotStuff_.split(","),allFishData:xmlDoc[0].getElementsByTagName("hotstuff")[0].attributes.getNamedItem('allFishData').value}) ;
}

function setItems(xmlDoc)
{
	var itemObj=  xmlDoc[0].getElementsByTagName("item");

	for(var j=0;j<itemObj.length;j++)
	{
		var item = new Object();
		item.id = itemObj[j].attributes.getNamedItem('id').value
		item.name = itemObj[j].attributes.getNamedItem('name').value
		item.price = itemObj[j].attributes.getNamedItem('price').value;
		item.subdetail = itemObj[j].attributes.getNamedItem('subdetail').value;
		if(itemObj[j].getElementsByTagName("detail")[0].firstChild != null)
		{
			item.detail = itemObj[j].getElementsByTagName("detail")[0].firstChild.nodeValue;
		}else{
			item.detail ="";
		}
		var p = itemObj[j].attributes.getNamedItem('pic');

		var pics = p.value.split(",");;

		item.pic = new Array();
		item.picture = itemObj[j].attributes.getNamedItem('path').value+""+pics[0];
		for(var k=0;k<pics.length;k++)
		{
			item.pic.push(itemObj[j].attributes.getNamedItem('path').value+""+pics[k]);
		}
		items[item.id] = (item);
	}
}

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;
}