 //http://pfeiferstudio.com/detail.aspx?ID=490&Name=Solid-Pine-Bench-Table
  var imagesFromXml= new Array();
  $(document).ready(function(){
    /*
    $("div:contains('Martin')").css("border", "3px double red");
	$("div:contains('John')").css("text-decoration", "underline");
	$("#container").append("hello");
	$("tr#ProductDetail11_trDescription a:first").addClass("test");
	$("tr#ProductDetail11_trDescription a:first").attr("href","photos/image1.jpg");
	$("tr#ProductDetail11_trDescription a:first").attr("rel", "lightBox");
	$("a[rel=lightBox]").lightBox({fixedNavigation:true});*/
	
	//For xml reading
	
	$.ajax({
	type:"GET",
	url:"http://www.pfeiferstudio.com/products.xml",
	dataType:"xml",
	success: parseXML
	});
	
	
  });
  
  
 function parseXML(xml)
  {
	
    var productId= getQueryString("ID");
	
   var productxml = $(xml).find("product[id ='"+ productId+"']");
   //alert(productxml);
   $(productxml).find("image").each(function(){
      
     imagesFromXml.push($(this).text());
	 
	});
	
	
	imagesFromXml.reverse();
	$("#container").append(imagesFromXml[0] +imagesFromXml[1] +imagesFromXml[2]);
	
	
	$("tr#ProductDetail11_trDescription a:first").attr("href", imagesFromXml.pop());
	$("tr#ProductDetail11_trDescription a:first").attr("rel", "lightBox");
	
   len= imagesFromXml.length;
   for(var i=0;i<len;i++)
   {
	   
	   var htmlOutput=" <a href='"+ imagesFromXml.pop() + "' rel='lightBox' ></a>";
	   $("body").append(htmlOutput);
      }
	  $("a[rel=lightBox]").lightBox({fixedNavigation:true});
   
  }
  
  
  function getQueryString(id)
  {
	 /*var searchStr=window.location.search.substring(1);
	 var qStrings=searchStr.split("&");
	 for(var i=0;i<qStrings.length;i++)
	 {
		strId=qStrings[i].split("=");
		if(strId[0].toLowerCase()==id.toLowerCase())
		{
		 return strId[1];
		}
	 }*/
	 return window.productId;
  }
  
