var http = getHTTPObject(); // We create the HTTP Object
var isWorking = false;
var dispayText;
var jsPath;
	// depending upon the browser type, it creates an HTTP object...
	function getHTTPObject()
	{
		var xmlhttp;
		/*@cc_on
		@if (@_jscript_version >= 5)
		try {
		  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
		  try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (E) {
			xmlhttp = false;
		  }
		}
		@else
		xmlhttp = false;
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
		{
			try{
			  xmlhttp = new XMLHttpRequest();
			} catch (e) {
			  xmlhttp = false;
			}
		}
		return xmlhttp;
	}

function fetchDetails(i, id, title, date, time, path, blogPath, desc, image)
{
	jsPath = path;
	dispayText = '<table width="307" border="0" cellspacing="0" cellpadding="0" align="center" style="padding:15px;">';
	dispayText +=	 '<tr>';
	dispayText +=	    '<td width="91" valign="top" style="padding:0px 13px 10px 10px;">';
	dispayText +=			'<a href="'+blogPath+'?p='+id+'" style="font-family:Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold;color:#050102; text-decoration:none;">';
	dispayText +=			'<img src="'+blogPath+'/wp-content/plugins/fresh-page/phpThumb.php?src='+blogPath+image+'&w=90" border="0" />';
	dispayText +=		   '</a>';
	dispayText +=	    '</td>';
	dispayText +=		'<td width="204" valign="top" style="padding:1px 0px 8px 0px;">';
	dispayText +=			'<div style="font-family:Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold; color:#050102; text-decoration:none;"><a href="'+blogPath+'?p='+id+'" style="font-family:Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold;color:#050102; text-decoration:none;">'+title+'</a></div>';
	dispayText +=			'<div style="font-family:Arial, Helvetica, sans-serif; font-size:11px; font-weight:bold; color:#fff; text-decoration:none; background:url('+jsPath+'/images/date_background.gif) left no-repeat; height:23px; padding:8px 0 0 4px;">&nbsp;'+date+' - '+time+'</div>';
	dispayText +=			'<div style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:normal; color:#050102; text-decoration:none; padding-right:5px;">'+desc+'</div>';
	dispayText +=			'<div style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:normal; color:#050102; text-decoration:none; padding-top:8px; padding-right:3px; float:right;"><a href="'+blogPath+'?p='+id+'" style="font-family:Arial, Helvetica, sans-serif; font-size:11px; font-weight:bold;color:#050102; text-decoration:none;">See Details &raquo;</a></div>';
	dispayText +=		'</td>';
	dispayText +=	  '</tr>';
	dispayText +=	'</table>';

	Tip(dispayText, BALLOON, true, ABOVE, true, WIDTH, 312, PADDING, 0, OPACITY, 100, TEXTALIGN, 'justify', SHADOW, true, DELAY, 100, STICKY, true);

/*
	if (!isWorking && http) 
	{
		Tip("<div style=\'font-weight:bold; text-align:center; padding:10px; width:307px;\'>Loading...</div>", BALLOON, true, ABOVE, true, OFFSETX, 0, WIDTH, 312, PADDING, 5, OPACITY, 100, TEXTALIGN, 'justify', SHADOW, true, DELAY, 0);
		http.open("GET", path+"/details_data_info.php?id="+id, true);
		http.onreadystatechange = httpResponse_SKUDetails;
		isWorking = true;
		http.send(null);
	}
*/
}

function httpResponse_SKUDetails()
{
	if (http.readyState == 4)
	{
		if (http.status == 200) 								// If the data was retrieved successfully
		{ 				
			// Use the XML DOM to unpack the data 
			var xmlResponse = http.responseXML.getElementsByTagName("xmlResponse")[0];

			if(xmlResponse.childNodes.length > 0)				// if RECORD EXISTS then loop till the End of Records for the
			{													// selected date.

				for(i=0; i<xmlResponse.childNodes.length; i++)
				{
					title		= xmlResponse.childNodes[i].firstChild.data;
					postdate	= xmlResponse.childNodes[i].getAttribute("postdate");
					description	= xmlResponse.childNodes[i].getAttribute("description");
//alert(title);
//alert(postdate);
//alert(description);

//				Tip("<div style=\'padding:2px; width:195px;\'><div style=\'font-size:12px;  font-weight:bold; padding-left:2px; padding-bottom:5px;\' align=\'left\'>"+ title +"</div><div style=\' font-size:12px; background-color:#000; color:#fff; padding:3px; width:97%;\' align=\'left\'>"+postdate+"</div><div style=\'padding:5px 2px;\'>"+description+"</div></div>", BALLOON, true, ABOVE, true, OFFSETX, -10, WIDTH, 200, PADDING, 5, OPACITY, 95, TEXTALIGN, 'justify', SHADOW, true, DELAY, 100);
				dispayText = '<table width="307" border="0" cellspacing="0" cellpadding="0" align="center" style="padding:15px;">';
				dispayText +=	 '<tr>';
				dispayText +=	    '<td width="91" valign="top" style="padding:10px 13px 10px 10px;"><img src="'+jsPath+'/images/calendar_image.jpg" width="91" height="104" border="0" /></td>';
				dispayText +=		'<td width="204" valign="top" style="padding:8px 0px;">';
				dispayText +=			'<div style="font-family:Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold;color:#050102; text-decoration:none;">'+title+'</div>';
				dispayText +=			'<div style="font-family:Arial, Helvetica, sans-serif; font-size:11px; font-weight:bold;color:#fff; text-decoration:none; background:url('+jsPath+'/images/date_background.gif) left no-repeat; height:23px; padding:8px 0 0 4px;">&nbsp;'+postdate+'</div>';
				dispayText +=			'<div style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:normal;color:#050102; text-decoration:none; padding-right:5px;">'+description+'</div>';
				dispayText +=		'</td>';
				dispayText +=	  '</tr>';
				dispayText +=	'</table>';

				Tip(dispayText, BALLOON, true, ABOVE, true, OFFSETX, -10, WIDTH, 312, PADDING, 5, OPACITY, 100, TEXTALIGN, 'justify', SHADOW, true, DELAY, 100);
				}
			}
			else													// if NO RECORD EXISTS for a selected date
			{	// recordStatus = NO RECORD EXISTS.
				alert('No Records to display');				
			}			
				
		} 
		else if (http.status != 0) 								// IE returns a status code of 0 on some occasions, so ignore this case
			 alert("Error while retrieving the URL: " + http.statusText); 
		isWorking = false;
	}
}


