// Slider Javascript
var count=1;
var page="page";

function transparent() {
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version < 7) && (document.body.filters)) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}
}



function moveSlideshow(elementID,final_x,final_y,interval) {
	document.getElementById('mytop').style.zIndex = 5;
	$("#nextbutton3").hide();
	$("#prevbutton3").hide();
	$("#nextbutton2").hide();
	$("#prevbutton2").hide();
	transparent();
    if (!document.getElementById) return false;
    if (!document.getElementById(elementID)) return false;
    var elem = document.getElementById(elementID);
    
    if (elem.movement) {
        clearTimeout(elem.movement);
    }
    
    var xpos = parseInt(elem.style.left);
    var ypos = parseInt(elem.style.top);
    if (xpos == final_x && ypos == final_y) {
		 $("#"+page+count).load("sub/"+page+count+".html");
		 document.getElementById('mytop').style.zIndex = 0;
        return true;
    }
    
    // restrict moving to white area
    if (final_x <= -elem.max_x) {
        final_x = -elem.max_x;
		document.getElementById('next').innerHTML="<div style='width:37px; height:69px'>&nbsp;</div>";
		transparent();
		//$("#next").hide();
    }else{
		document.getElementById('next').innerHTML="<a href='#' onClick='javascript:next();'><img src='Images/next.png' border='0' /></a>";
		transparent();
		//$("#next").show();
	}
	
	if (final_x > -1) {
	    document.getElementById('previous').innerHTML="<div style='width:37px; height:69px'>&nbsp;</div>";
		//$("#previous").hide();
		transparent();
    }else{
		document.getElementById('previous').innerHTML="<a href='#' onClick='javascript:previous();'><img src='Images/previous.png' border='0' /></a>";
		transparent();
		//$("#previous").show();
	}
	
    if (final_x > 0) {
	    final_x = 0;
    }
    
    if (xpos < final_x) {
        var dist = Math.ceil((final_x - xpos)/10);
        xpos = xpos + dist;
    }
	
    if (xpos > final_x) {
        var dist = Math.ceil((xpos - final_x)/10);
        xpos = xpos - dist;
    }
  
    if (xpos <= -elem.max_x) {
	    xpos = -elem.max_x;
    }
    if (xpos > 0) {
	    xpos = 0;
    }
    
    elem.style.left = xpos + "px";
    elem.style.top = ypos + "px";
    
    var repeat = "moveSlideshow('"+elementID+"',"+final_x+","+final_y+","+interval+")";
    elem.movement = setTimeout(repeat,interval);
}

function prepareSlideshow() {
	var slideshow_set = document.getElementById("slideshow_set");
		var x = parseInt(slideshow_set.style.left);
		
		if (x % 950 != 0) {
	    document.getElementById('previous').innerHTML="<div style='width:37px; height:69px'>&nbsp;</div>";
		transparent();
		//$("#previous").hide();
		transparent();
    }
		
  	if (!document.getElementsByTagName) return false;
  	if (!document.getElementById) return false;
  	
  	if (!document.getElementById("slideshow")) return false;
  	var slideshow = document.getElementById("slideshow");
  	var wrapper = document.getElementById("slideshow_wrapper");
  	wrapper.style.overflow = "hidden";
  	
  
	
	var slideshow_set = document.getElementById("slideshow_set");
	slideshow_set.style.top = 0+"px";
	slideshow_set.style.left = 0+"px";
	
	var li = slideshow_set.getElementsByTagName("li");
	slideshow_set.max_x = (li.length-1) * 950;
	slideshow_set.max_y = li.length * 460;
	
	var width = li.length * 950;
	slideshow_set.style.width = width + "px";
}

  	function previous() {
	$("#content1").hide();
	$("#content2").hide();
	$("#content3").hide();
	$("#content4").hide();
	$("#content5").hide();
	$("#content6").hide();
	$("#content7").hide();
	$("#container1").hide();
	$("#container2").hide();
	$("#container3").hide();
	$("#container4").hide();
	$("#container5").hide();
		//document.getElementById('next').innerHTML="<a href='#'><img src='Images/next.png' border='0' /></a>";
		//document.getElementById('previous').innerHTML="<a href='#'><img src='Images/previous.png' border='0' /></a>";
		//$("#previous_anti").show();
		//$("#next_anti").show();
		//$("#previous").hide();
		//$("#next").hide();
		transparent();
		count = count - 1;

		if(count<1){
			count=5;
		}else{
			$("#loading"+count).html("<img src='Images/loading.gif' border='0' />");
		}
		
		for (j=0;j<=5;j++)
		{
			if(j==count){
				$("#navi"+j).html('<img src="Images/dot_navi.gif" border="0" />');
			}else{
				$("#navi"+j).html('<a href="#" onClick="javascript:next_navi'+j+'();"><img src="Images/navi' + j + '.gif" border="0" /></a>');
			}
		}
		
		var slideshow_set = document.getElementById("slideshow_set");
		var x = parseInt(slideshow_set.style.left);
		if (x % 950 == 0) {
			document.getElementById('next').innerHTML="<a href='#'><img src='Images/next.png' border='0' /></a>";
			transparent();
			//$("#next").hide();
    		moveSlideshow("slideshow_set",x+950,0,10);
		}
		return false;
	}
	
  	function next()  {
	$("#content1").hide();
	$("#content2").hide();
	$("#content3").hide();
	$("#content4").hide();
	$("#content5").hide();
	$("#content6").hide();
	$("#content7").hide();
	$("#container1").hide();
	$("#container2").hide();
	$("#container3").hide();
	$("#container4").hide();
	$("#container5").hide();
		//$("#previous_anti").show();
		//$("#next_anti").show();
		//$("#previous").hide();
		//$("#next").hide();
		//document.getElementById('next').innerHTML="<a href='#'><img src='Images/next.png' border='0' /></a>";
		//document.getElementById('previous').innerHTML="<a href='#'><img src='Images/previous.png' border='0' /></a>";
		transparent();
		count = count + 1;
		
		if(count>5){
			count=1;
		}else{
			$("#loading"+count).html("<img src='Images/loading.gif' border='0' />");
		}
		
		for (i=0;i<=5;i++)
		{
			if(i==count){
				$("#navi"+i).html('<img src="Images/dot_navi.gif" border="0" />');
			}else{
				$("#navi"+i).html('<a href="#" onClick="javascript:next_navi'+i+'();"><img src="Images/navi' + i + '.gif" border="0" /></a>');
			}
		}

		
		var slideshow_set = document.getElementById("slideshow_set");
		var x = parseInt(slideshow_set.style.left);
    	if (x % 950 == 0) {
			document.getElementById('previous').innerHTML="<a href='#'><img src='Images/previous.png' border='0' /></a>";
			transparent();
			//$("#previous").hide();
    		moveSlideshow("slideshow_set",x-950,0,10);
		}
		return false;
	}
	
	function next_navi1(){
		count=1;
		document.getElementById('mytop').style.zIndex = 0;
		document.getElementById('next').innerHTML="<a href='#' onClick='javascript:next();'><img src='Images/next.png' border='0' /></a>";
		//$("#next").show();
		document.getElementById('previous').innerHTML="<div style='width:37px; height:69px'>&nbsp;</div>";
		transparent();
		$("#content1").hide();
	$("#content2").hide();
	$("#content3").hide();
	$("#content4").hide();
	$("#content5").hide();
	$("#content6").hide();
	$("#content7").hide();
	$("#container1").hide();
	$("#container2").hide();
	$("#container3").hide();
	$("#container4").hide();
	$("#container5").hide();
	$("#nextbutton3").hide();
	$("#prevbutton3").hide();
	$("#nextbutton2").hide();
	$("#prevbutton2").hide();
		
		$("#navi1").html('<img src="Images/dot_navi.gif" border="0" />');
		$("#navi2").html('<a href="#" onClick="javascript:next_navi2();"><img src="Images/navi2.gif" border="0" /></a>');
		$("#navi3").html('<a href="#" onClick="javascript:next_navi3();"><img src="Images/navi3.gif" border="0" /></a>');
		$("#navi4").html('<a href="#" onClick="javascript:next_navi4();"><img src="Images/navi4.gif" border="0" /></a>');
		$("#navi5").html('<a href="#" onClick="javascript:next_navi5();"><img src="Images/navi5.gif" border="0" /></a>');

		document.getElementById("slideshow_set").style.top = 0+"px";
		document.getElementById("slideshow_set").style.left = 0+"px";
	}
	
	function next_navi2(){
		count=2;
		document.getElementById('mytop').style.zIndex = 0;
		document.getElementById('next').innerHTML="<a href='#' onClick='javascript:next();'><img src='Images/next.png' border='0' /></a>";
		//$("#next").show();
		document.getElementById('previous').innerHTML="<a href='#' onClick='javascript:previous();'><img src='Images/previous.png' border='0' /></a>";
		transparent();
		//$("#previous").show();
		$("#content1").hide();
	$("#content2").hide();
	$("#content3").hide();
	$("#content4").hide();
	$("#content5").hide();
	$("#content6").hide();
	$("#content7").hide();
	$("#container1").hide();
	$("#container2").hide();
	$("#container3").hide();
	$("#container4").hide();
	$("#container5").hide();
	$("#nextbutton3").hide();
	$("#prevbutton3").hide();
	$("#nextbutton2").hide();
	$("#prevbutton2").hide();
		
		$("#navi1").html('<a href="#" onClick="javascript:next_navi1();"><img src="Images/navi1.gif" border="0" /></a>');
		$("#navi2").html('<img src="Images/dot_navi.gif" border="0" />');
		$("#navi3").html('<a href="#" onClick="javascript:next_navi3();"><img src="Images/navi3.gif" border="0" /></a>');
		$("#navi4").html('<a href="#" onClick="javascript:next_navi4();"><img src="Images/navi4.gif" border="0" /></a>');
		$("#navi5").html('<a href="#" onClick="javascript:next_navi5();"><img src="Images/navi5.gif" border="0" /></a>');
		
		
		$("#loading"+count).html("<img src='Images/loading.gif' border='0' />");
		
		$("#"+page+count).load("sub/"+page+count+".html",null,function()
			{
				$("#loading"+count).html('');
			});
		document.getElementById("slideshow_set").style.top = 0+"px";
		document.getElementById("slideshow_set").style.left = -950+"px";
	}
	
	function next_navi3(){
		count=3;
		document.getElementById('mytop').style.zIndex = 0;
		document.getElementById('next').innerHTML="<a href='#' onClick='javascript:next();'><img src='Images/next.png' border='0' /></a>";
		//$("#next").show();
		document.getElementById('previous').innerHTML="<a href='#' onClick='javascript:previous();'><img src='Images/previous.png' border='0' /></a>";
		transparent();
		//$("#previous").show();
		$("#content1").hide();
	$("#content2").hide();
	$("#content3").hide();
	$("#content4").hide();
	$("#content5").hide();
	$("#content6").hide();
	$("#content7").hide();
	$("#container1").hide();
	$("#container2").hide();
	$("#container3").hide();
	$("#container4").hide();
	$("#container5").hide();
	$("#nextbutton3").hide();
	$("#prevbutton3").hide();
	$("#nextbutton2").hide();
	$("#prevbutton2").hide();
		
		$("#navi1").html('<a href="#" onClick="javascript:next_navi1();"><img src="Images/navi1.gif" border="0" /></a>');
		$("#navi2").html('<a href="#" onClick="javascript:next_navi2();"><img src="Images/navi2.gif" border="0" /></a>');
		$("#navi3").html('<img src="Images/dot_navi.gif" border="0" />');
		$("#navi4").html('<a href="#" onClick="javascript:next_navi4();"><img src="Images/navi4.gif" border="0" /></a>');
		$("#navi5").html('<a href="#" onClick="javascript:next_navi5();"><img src="Images/navi5.gif" border="0" /></a>');
		
		
		$("#loading"+count).html("<img src='Images/loading.gif' border='0' />");
		
		$("#"+page+count).load("sub/"+page+count+".html",null,function()
			{
				$("#loading"+count).html('');
			});
		document.getElementById("slideshow_set").style.top = 0+"px";
		document.getElementById("slideshow_set").style.left = -1900+"px";
	}
	
	function next_navi4(){
		count=4;
		document.getElementById('mytop').style.zIndex = 0;
		document.getElementById('next').innerHTML="<a href='#' onClick='javascript:next();'><img src='Images/next.png' border='0' /></a>";
		//$("#next").show();
		document.getElementById('previous').innerHTML="<a href='#' onClick='javascript:previous();'><img src='Images/previous.png' border='0' /></a>";
		transparent();
		//$("#previous").show();
		$("#content1").hide();
	$("#content2").hide();
	$("#content3").hide();
	$("#content4").hide();
	$("#content5").hide();
	$("#content6").hide();
	$("#content7").hide();
	$("#container1").hide();
	$("#container2").hide();
	$("#container3").hide();
	$("#container4").hide();
	$("#container5").hide();
	$("#nextbutton3").hide();
	$("#prevbutton3").hide();
	$("#nextbutton2").hide();
	$("#prevbutton2").hide();
		
		$("#navi1").html('<a href="#" onClick="javascript:next_navi1();"><img src="Images/navi1.gif" border="0" /></a>');
		$("#navi2").html('<a href="#" onClick="javascript:next_navi2();"><img src="Images/navi2.gif" border="0" /></a>');
		$("#navi3").html('<a href="#" onClick="javascript:next_navi3();"><img src="Images/navi3.gif" border="0" /></a>');
		$("#navi4").html('<img src="Images/dot_navi.gif" border="0" />');
		$("#navi5").html('<a href="#" onClick="javascript:next_navi5();"><img src="Images/navi5.gif" border="0" /></a>');
		
		
		$("#loading"+count).html("<img src='Images/loading.gif' border='0' />");
		
		$("#"+page+count).load("sub/"+page+count+".html",null,function()
			{
				$("#loading"+count).html('');
			});
		document.getElementById("slideshow_set").style.top = 0+"px";
		document.getElementById("slideshow_set").style.left = -2850+"px";
	}
	
	function next_navi5(){
		count=5;
		document.getElementById('mytop').style.zIndex = 0;
		document.getElementById('next').innerHTML="<div style='width:37px; height:69px'>&nbsp;</div>";
		//$("#next").hide();
		document.getElementById('previous').innerHTML="<a href='#' onClick='javascript:previous();'><img src='Images/previous.png' border='0' /></a>";
		transparent();
		//$("#previous").show();
		$("#content1").hide();
	$("#content2").hide();
	$("#content3").hide();
	$("#content4").hide();
	$("#content5").hide();
	$("#content6").hide();
	$("#content7").hide();
	$("#container1").hide();
	$("#container2").hide();
	$("#container3").hide();
	$("#container4").hide();
	$("#container5").hide();
	$("#nextbutton3").hide();
	$("#prevbutton3").hide();
	$("#nextbutton2").hide();
	$("#prevbutton2").hide();
		
		$("#navi1").html('<a href="#" onClick="javascript:next_navi1();"><img src="Images/navi1.gif" border="0" /></a>');
		$("#navi2").html('<a href="#" onClick="javascript:next_navi2();"><img src="Images/navi2.gif" border="0" /></a>');
		$("#navi3").html('<a href="#" onClick="javascript:next_navi3();"><img src="Images/navi3.gif" border="0" /></a>');
		$("#navi4").html('<a href="#" onClick="javascript:next_navi4();"><img src="Images/navi4.gif" border="0" /></a>');
		$("#navi5").html('<img src="Images/dot_navi.gif" border="0" />');
		
		
		$("#loading"+count).html("<img src='Images/loading.gif' border='0' />");
		
		$("#"+page+count).load("sub/"+page+count+".html",null,function()
			{
				$("#loading"+count).html('');
			});
		document.getElementById("slideshow_set").style.top = 0+"px";
		document.getElementById("slideshow_set").style.left = -3800+"px";
	}
