// ===========
// RSS loader
//

function loadRss(){
	$.post("proxy.php?url=http://splash.mainstreamdata.com/RSS/Celebrity-RSS.xml", { action: "get" } , function(d) {
		
		var iphoneContent = "<ul id='iphone_slider'>";
		
		//find each 'item' in the file and parse it
		$(d).find('item').each(function() {
			$(this).children().each(function(item){
				if(this.nodeName == "media:thumbnail"){
					iphoneContent += '<li><img src="'+this.attributes.getNamedItem('url').nodeValue+'"></li>';
				}
			})
		});
		iphoneContent += "</ul>";
		
		//clear the content in the div for the next feed.
		$("#iphone_content").empty();
		
		// Append content to page
		$("#iphone_content").append(iphoneContent);
		
	});
}

// ===========
// iPhone slider
//

function loadSlider() {
	
	// loadRss();
	
	$('#iphone_slider').bxSlider({
			mode: 'slide',
			auto: true,
			controls: false,
			speed: 1500,
			pause: 3000,
			width: 283,
			wrapper_class: 'iphone_slider_container'
		});
	$('#iphone_slider').show();
}

function loadRandomGraphic(){
	
	var graphicUrl = ["SplashSNTV.gif",
										"SplashiPhone2.gif",
										"SplashMultilingual.gif",
										"SplashWire.gif"];
	
	var randomnumber=Math.floor(Math.random()*graphicUrl.length)
	
	
	$("#right-graphic").html("<img  src='./_customer/images/" + graphicUrl[randomnumber] + "' width='512' height='254' border='0'>");
}

$(document).ready(function() {
	// Load random graphic
	loadRandomGraphic();

	// Load the slider
	loadSlider();
});

$(function() {
	$(this).bind("contextmenu", function(e) {
		e.preventDefault();
	});
});
