	// <![CDATA[					
	var i=0,n,myAdsItems,k=0,rid,cid;
	$(function()
	{
		var adsXML = getXML("./PI.xml");
		myAdsItems = new myAds(adsXML);
		n = myAdsItems.items.length;
		$.each(myAdsItems.items[0],function(name,value)
		{
			//alert(name + " <NAME ::::: VALUE> '" + value + "' :: n> " + value.length);
		});
		i = -1;
		rotate();
		color();
	});
	function rotate()
	{
		i = (((i+1).length == 0)?0:(i+1))%n;
		var line1 = ((myAdsItems.items[i].address + myAdsItems.items[i].cityZip).length<3)?false:true;
		var line2 = (!line1)?(myAdsItems.items[i].url):(myAdsItems.items[i].address + ", " + myAdsItems.items[i].cityZip);
		var phone = (myAdsItems.items[i].phone.length)?('p:'+myAdsItems.items[i].phone):('');
		var fax   = (myAdsItems.items[i].fax.length)?(' f:'+myAdsItems.items[i].fax):('');
		$("#piad").html(
			myAdsItems.items[i].title + "<br/>" +
			line2 + "<br/>" +
			phone + fax + "<br/>" +
			myAdsItems.items[i].memo
		).click(function(){location.href=myAdsItems.items[i].url;});
		rid=setTimeout("rotate()",6000);
	}
	function color()
	{
		switch(k++%3)
		{
			case 0:
				$("#piad").css(
				{
					color:'black',
					fontWeight:'bold',
					background:'beige',
					border:'1px solid beige'
				});
				break;
			case 1:
				$("#piad").css(
				{
					color:'yellow',
					background:'blue',
					border:'1px solid blue'
				});
				break;
			case 2:
				$("#piad").css(
				{
					color:'blue',
					background:'yellow',
					border:'1px solid yellow'
				});
				break;
		}	
		cid=setTimeout("color()",2000);
	}
	function myItem(itemxml)
	{
		this.id          = $(itemxml).find('id').text();
		this.title       = $(itemxml).find('title').text();
		this.name        = $(itemxml).find('name').text();
		this.url         = $(itemxml).find('url').text();
		this.description = $(itemxml).find('description').text();
		this.image       = $(itemxml).find('image').text();
		this.address     = $(itemxml).find('address').text();
		this.cityZip     = $(itemxml).find('cityZip').text();
		this.phone       = $(itemxml).find('phone').text();
		this.fax         = $(itemxml).find('fax').text();
		this.memo        = $(itemxml).find('memo').text();
	}
	function myAds(adsXML)
	{
		this.items = new Array();myArr = new Array();
		$(adsXML).find('item').each(function()
		{
			Item = new myItem(this);
			myArr.push(Item);
		});
		this.items = myArr;
	}
	function getText(fl)
	{
		return $.ajax({ url: fl, cache: false, async: false }).responseText;
	}
	function getXML(fl)
	{
		return $.ajax({ url: fl, cache: false, async: false }).responseXML;
	}
	//]]>