﻿function addSlideshow()
{
	var display = "block";
	var ancorDisplay = "inline-block";
	var descriptionHeight = 30;
	var cursor = "pointer";
	
	if(isiPad())
	{
		var text = '<div id="demoSliderContainer"> <ul id="demoSlider" class="slide-images transition-opacity">';
		
		for(i = 0; i < images.length; i++)
		{
			title[i] = title[i].toUpperCase();
						
			if(title[i] == "")
			{
				display = "none";
				ancorDisplay = "none";
				descriptionHeight = 15;
				cursor = "auto";
			}
		
			text += '<li href="javascript:void(0)" onclick="linkClick(' + "'" + i + "'" + ')" style="cursor:' + cursor + ';" class="slide-image current"> <img src="' + images[i] + '"> <h4 style="display:' + display + '; width:' + titleWidth[i] + 'px">&nbsp;' + title[i] + '</h4> <span style="width:' + descriptionWidth[i] + 'px; height:' + descriptionHeight + 'px; margin-left:-2px; line-height: 120%">&nbsp;' + description[i] + '<br><h3 style="line-height:60%; display:' + ancorDisplay + ';"><a style="padding:0px 0px 0px 0px; border-bottom-padding:10px; border-bottom-style:solid; border-bottom:solid #ffffff; border-bottom-width: 1px;">» Read more</a></h3></span> </li>';
		}
		
		text += '</ul> </div>';
	 
		document.write(text);
	}
	else
	{		
		var text = '<div class="slideshow">';
						
		for(i = 0; i < images.length; i++)
		{
			title[i] = title[i].toUpperCase();
						
			if(title[i] == "")
			{
				display = "none";
				ancorDisplay = "none";
				descriptionHeight = 15;
				cursor = "auto";
			}
			
			text += '<div href="javascript:void(0)" onclick="linkClick(' + "'" + i + "'" + ')" style="cursor:' + cursor + '; background-image:url(' + "'" + images[i] + "'" + '); width:874px; height:236px; display:block;"> <div class="alpha60" style="width:' + titleWidth[i] + 'px; display:' + display + ';"> <h4 style="width:' +  titleWidth[i] + 'px">&nbsp;' + title[i] + '</h4> </div> <div class="ppp" style="background-color: rgba(0, 168, 230, 0.7); width:' + descriptionWidth[i] + 'px; height:' + descriptionHeight + 'px; margin-left:0px; line-height: 120%">&nbsp;' + description[i] + '<h3 id="linkText' + i + '" onmouseover="linkMouseOver(' + "'" + i + "'" + ')" onmouseout="linkMouseOut(' + "'" + i + "'" + ')" style="line-height:60%; display:' + ancorDisplay + ';"><span id="line' + i + '" style="padding:0px 0px 0px 0px; border-bottom-padding:10px; border-bottom-style:solid; border-bottom:solid #ffffff; border-bottom-width: 1px;">» Read more<br/></span>&nbsp;</h3></div></div>';
		}
		
		text += '</div>';
		
		document.write(text);		
	}
}

function linkClick(i)
{
	if(title[i] == "")
		return;
				
	window.location.href= links[i];
}

function linkMouseOver(i)
{
	document.getElementById("linkText" + i).style.color = "#bde6f4";
	document.getElementById("line" + i).style.borderBottom = "solid #bde6f4 1px";
}

function linkMouseOut(i)
{
	document.getElementById("linkText" + i).style.color = "#ffffff";
	document.getElementById("line" + i).style.borderBottom = "solid #ffffff 1px";
}
