var bcount = -1;//counter
var mySwitch = 0;
var t;//this var will hold the setTimeout() function
var imgPath_1 = '<img src="images/slideshow_web_omgfree.jpg" />';
var imgPath_2 = '<img src="images/slideshow_web_omgmobile.jpg" />';
var imgPath_3 = '<img src="images/slideshow_web_3.jpg" />';
var imgPath_4 = '<img src="images/slideshow_web_1.jpg" />';

var thumbs = ["slideshow_web_omgfree.png","slideshow_marketing_horizon_btn.png","slideshow_web_hosting_btn.png","slideshow_web_fbook_btn.png",""];
var currentSlideBtn = ["slideshow_web_omgfree_over.png","slideshow_marketing_horizon_btn_over.png","slideshow_web_hosting_btn_over.png","slideshow_web_fbook_btn_over.png",""]

function MM_effectAppearFade(targetElement, duration, from, to, toggle)
{
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}

function timerFunction()
{
	bcount = bcount+1;//add 1 every time this function is executed
	
	if (bcount == 0)
	{
		//fade out current slide
		MM_effectAppearFade('imageContainer', 500, 100, 0, false);
		MM_effectAppearFade('myDov', 500, 100, 0, false);
	}
	else if (bcount == 1)
	{
		//fade in slide 1
		MM_effectAppearFade('imageContainer', 500, 0, 100, false);
		MM_effectAppearFade('myDov', 500, 0, 100, false);
		document.getElementById('imageContainer').innerHTML = imgPath_1;
		document.getElementById('myDov').innerHTML = '<h1>We are Social Media Specialists</h1>We are experts in small business social media marketing. With our knowledge of best practices and implementation, let us create your flagship social networking tool for free!<br><br><span class="SlideshowLinks"><a href="articles/omgfree.php">Learn More<img src="images/learnarrow.jpg" border="0" align="absmiddle" /></a></span>';
		document.getElementById('slide1_btn').innerHTML = '<img src="images/'+currentSlideBtn[0]+'" />';
		//document.getElementById('slide1_btn').style.border = "solid 0px #000000";
		document.getElementById('slide2_btn').innerHTML = '<img src="images/'+thumbs[1]+'" />';
		document.getElementById('slide3_btn').innerHTML = '<img src="images/'+thumbs[2]+'" />';
		document.getElementById('slide4_btn').innerHTML = '<img src="images/'+thumbs[3]+'" />';
	}
	else if (bcount == 10)
	{
		//fade out current slide
		MM_effectAppearFade('imageContainer', 500, 100, 0, false);
		MM_effectAppearFade('myDov', 500, 100, 0, false);
	}
	else if (bcount == 11)
	{
		//fade in slide 2
		MM_effectAppearFade('imageContainer', 500, 0, 100, false);
		MM_effectAppearFade('myDov', 500, 0, 100, false);
		document.getElementById('imageContainer').innerHTML = imgPath_2;
		document.getElementById('myDov').innerHTML = '<h1>Mobilize Your Website!</h1>Mobile web browsing is quickly replacing the typical computer interface as the most prevalent way for a virtual visit to your company. Update your existing internet presence with a new, sleek mobile site.<br><br><span class="SlideshowLinks"><a href="articles/omgmobile.php">Learn More<img src="images/learnarrow.jpg" border="0" align="absmiddle" /></a></span>';//write text inside the content div
		document.getElementById('slide1_btn').innerHTML = '<img src="images/'+thumbs[0]+'" />';
		document.getElementById('slide2_btn').innerHTML = '<img src="images/'+currentSlideBtn[1]+'" />';
		document.getElementById('slide3_btn').innerHTML = '<img src="images/'+thumbs[2]+'" />';
		document.getElementById('slide4_btn').innerHTML = '<img src="images/'+thumbs[3]+'" />';
	}
	else if (bcount == 20)
	{
		//fade out current slide
		MM_effectAppearFade('imageContainer', 500, 100, 0, false);
		MM_effectAppearFade('myDov', 500, 100, 0, false);
	}
	else if (bcount == 21)
	{
		//fade in slide 3
		MM_effectAppearFade('imageContainer', 500, 0, 100, false);
		MM_effectAppearFade('myDov', 500, 0, 100, false);
		document.getElementById('imageContainer').innerHTML = imgPath_3;
		document.getElementById('myDov').innerHTML = '<h1>Hosting Packages that Include Website Revising</h1>Use a hosting provider with the creative staff to make changes to your site. The days of unsupported creative content from hosting providers are over. Get soup to nuts service from OMG National.<br><br><span class="SlideshowLinks"><a href="articles/hostingpackages.php">Learn More<img src="images/learnarrow.jpg" border="0" align="absmiddle" /></a></span>';//write text inside the content div
		document.getElementById('slide1_btn').innerHTML = '<img src="images/'+thumbs[0]+'" />';
		document.getElementById('slide2_btn').innerHTML = '<img src="images/'+thumbs[1]+'" />';
		document.getElementById('slide3_btn').innerHTML = '<img src="images/'+currentSlideBtn[2]+'" />';
		document.getElementById('slide4_btn').innerHTML = '<img src="images/'+thumbs[3]+'" />';
	}
	else if (bcount == 30)
	{
		//fade out current slide
		MM_effectAppearFade('imageContainer', 500, 100, 0, false);
		MM_effectAppearFade('myDov', 500, 100, 0, false);
	}
	else if (bcount == 31)
	{
		//fade in slide 4
		MM_effectAppearFade('imageContainer', 500, 0, 100, false);
		MM_effectAppearFade('myDov', 500, 0, 100, false);
		document.getElementById('imageContainer').innerHTML = imgPath_4;
		document.getElementById('myDov').innerHTML = '<h1>Facebook: The Face of the Net?</h1>Facebook has revolutionized the world. Now let it earn you money. Join OMG National in its latest push to tap into all the hidden value that one of the Internet&acute;s biggest portals has to offer.<br><br><span class="SlideshowLinks"><a href="articles/facebook_faces.php">Learn More<img src="images/learnarrow.jpg" border="0" align="absmiddle" /></a></span>';//write text inside the content div
		document.getElementById('slide1_btn').innerHTML = '<img src="images/'+thumbs[0]+'" />';
		document.getElementById('slide2_btn').innerHTML = '<img src="images/'+thumbs[1]+'" />';
		document.getElementById('slide3_btn').innerHTML = '<img src="images/'+thumbs[2]+'" />';
		document.getElementById('slide4_btn').innerHTML = '<img src="images/'+currentSlideBtn[3]+'" />';
	}
	else if (bcount == 40)
	{
		//fade out current slide
		MM_effectAppearFade('imageContainer', 500, 100, 0, false);
		MM_effectAppearFade('myDov', 500, 100, 0, false);
	}
	else if (bcount == 41)//if the counter reaches 25, reset it to -1
	{
		bcount = 0;
	}
	
	if (mySwitch == 0)
	{
		setTimeout("timerFunction()",500);//do this function every second
	} 
	else
	{
		return;
	}
	
}

function setSlideshowButtons()
{
	/*document.getElementById('slide1_btn').innerHTML = imgPath_1;
	document.getElementById('slide2_btn').innerHTML = imgPath_2;
	document.getElementById('slide3_btn').innerHTML = imgPath_3;
	document.getElementById('slide4_btn').innerHTML = imgPath_4;
	document.getElementById('slide5_btn').innerHTML = imgPath_5;*/
	for (var bcount=1; bcount<5; bcount++)
	{
		document.getElementById('slide'+bcount+'_btn').innerHTML = '<img src="images/'+thumbs[bcount-1]+'" />';
	}
}

function slideshowRollover(btnID,event)
{
	if (event.type == "mouseover")
	{
		document.getElementById(btnID).style.cursor = "pointer";
	}
	else if (event.type == "mouseout")
	{
		document.getElementById(btnID).style.cursor = "default";
	}
}

function slideButtonClick(btn)
{
	if (btn == "slide1_btn")
	{
		bcount = -1;
		document.getElementById('slide1_btn').style.border = "solid 0px #000000";
		document.getElementById('slide2_btn').style.border = "solid 0px #FFFFFF";
		document.getElementById('slide3_btn').style.border = "solid 0px #FFFFFF";
		document.getElementById('slide4_btn').style.border = "solid 0px #FFFFFF";
		
		if (mySwitch == 1)
		{
			document.getElementById('imageContainer').innerHTML = imgPath_1;
			document.getElementById('myDov').innerHTML = '<span class="SlideshowTitleText">Facebook: The Face of the Net?</span><br><br>Facebook has revolutionized the world. Now let it earn you money. Join OMG National in its latest push to tap into all the hidden value that one of the Internet&acute;s biggest portals has to offer.<br><br><span class="SlideshowLinks"><a href="articles/facebook_faces.php">Learn More<img src="images/learnarrow.jpg" border="0" align="absmiddle" /></a></span>';
		}
		
	}
	else if (btn == "slide2_btn")
	{
		bcount = 9;
		document.getElementById('slide1_btn').style.border = "solid 0px #FFFFFF";
		document.getElementById('slide2_btn').style.border = "solid 0px #000000";
		document.getElementById('slide3_btn').style.border = "solid 0px #FFFFFF";
		document.getElementById('slide4_btn').style.border = "solid 0px #FFFFFF";
		
		if (mySwitch == 1)
		{
			document.getElementById('imageContainer').innerHTML = imgPath_2;
			document.getElementById('myDov').innerHTML = '<span class="SlideshowTitleText">Mobilize Your Website!</span><br><br>Mobile web browsing is quickly replacing the typical computer interface as the most prevalent way for a virtual visit to your company. Update your existing internet presence with a new, sleek mobile site.<br><br><span class="SlideshowLinks"><a href="articles/omgmobile.php">Learn More<img src="images/learnarrow.jpg" border="0" align="absmiddle" /></a></span>';
		}
		
	}
	else if (btn == "slide3_btn")
	{
		bcount = 19;
		document.getElementById('slide1_btn').style.border = "solid 0px #FFFFFF";
		document.getElementById('slide2_btn').style.border = "solid 0px #FFFFFF";
		document.getElementById('slide3_btn').style.border = "solid 0px #000000";
		document.getElementById('slide4_btn').style.border = "solid 0px #FFFFFF";
		
		if (mySwitch == 1)
		{
			document.getElementById('imageContainer').innerHTML = imgPath_3;
			document.getElementById('myDov').innerHTML = '<span class="SlideshowTitleText">Hosting Packages that Include Website Revising</span><br><br>Use a hosting provider with the creative staff to make changes to your site. The days of unsupported creative content from hosting providers are over. Get soup to nuts service from OMG National.<br><br><span class="SlideshowLinks"><a href="articles/hostingpackages.php">Learn More<img src="images/learnarrow.jpg" border="0" align="absmiddle" /></a></span>';
		}
		
	}
	else if (btn == "slide4_btn")
	{
		bcount = 29;
		document.getElementById('slide1_btn').style.border = "solid 0px #FFFFFF";
		document.getElementById('slide2_btn').style.border = "solid 0px #FFFFFF";
		document.getElementById('slide3_btn').style.border = "solid 0px #FFFFFF";
		document.getElementById('slide4_btn').style.border = "solid 0px #000000";
		
		if (mySwitch == 1)
		{
			document.getElementById('imageContainer').innerHTML = imgPath_4;
			document.getElementById('myDov').innerHTML = '<span class="SlideshowTitleText">Is PPC really Effective?</span><br><br>We are experts in small business social media marketing. With our knowledge of best practices and implementation, let us create your flagship social networking tool for free!<br><br><span class="SlideshowLinks"><a href="articles/omgfree.php">Learn More<img src="images/learnarrow.jpg" border="0" align="absmiddle" /></a></span>';
		}
		
	}
	
}

function pausePlaySlideshow()
{
	if (mySwitch == 0)
	{
		mySwitch = 1;
		MM_swapImage('play','','images/slideshow_control_play_blue.png',1);
		
	} else if (mySwitch == 1)
	{
		mySwitch = 0;
		timerFunction();
		MM_swapImgRestore();
	}
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
