var SlideNum = 1;
var NameNum = 0;
var PhotoNum = 0;
var CurrentSlideNum = 1;
var CurrentNameNum = 0;
var CurrentPhotoNum = 0;
var AllSlides = 43;

var TopicNum = 0;
var CurrentTopicNum = 0;

var NewWindow = '';
var newwindow14 = '';
var slide_num = SlideNum;


if (window.bHasWMP7) {
	playerVersion = "7";
} else {
	playerVersion = "below7";
}

function pop(){
       newwin=window.open("","","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=420,height=300,screenX=0,screenY=0,top=0,left=0");
       newwin.opener=self;
       }

function listslide2() {
//document.writeln("<table border='0' cellspacing='0' cellpadding='0'>");
//document.writeln("<tr>");

AllSlides = 29;
	for(i=1; i<=AllSlides; i++) {
	    //if ((i-1 % 5) == 0) { document.writeln("<tr>");}
		document.writeln("<td align='left'>");
		document.writeln("<img src='images/spacer.gif' width='14' height='10' border=0><a href='#"+i+"' onclick='parent.SeekToSlide("+i+");'><img src='sslides/"+i+".jpg' width='80' height='60' border='0' style='padding:0;margin:0'></a><img name='"+i+"' src='images/spacer.gif' width='10' height='10' border='0'>");
		document.writeln("<img src='images/pingan_dot_bk.gif' border=0 align=left name='dot_name"+i+"'><DIV id='a"+i+"' style='font: 12px Arial;margin:0;padding-top:0;color:black;padding-bottom:15px;'>&#160;&#160;Slide&#160;"+i+"</DIV>");
		document.writeln("</td>");	
		//	if ((i % 4) == 0) { document.writeln("</tr>");}


		}

		//				document.writeln("</table>");	    overflow:hidden;
       }	   

function listslide2c() {
//document.writeln("<table border='0' cellspacing='0' cellpadding='0'>");
//document.writeln("<tr>");

AllSlides = 29;
	for(i=1; i<=AllSlides; i++) {
	    //if ((i-1 % 5) == 0) { document.writeln("<tr>");}
		document.writeln("<td align='left'>");
		document.writeln("<img src='images/spacer.gif' width='14' height='10' border=0><a href='#"+i+"' onclick='parent.SeekToSlide("+i+");'><img src='sslides/"+i+".jpg' width='80' height='60' border='0' style='padding:0;margin:0'></a><img name='"+i+"' src='images/spacer.gif' width='10' height='10' border='0'>");
		document.writeln("<img src='images/pingan_dot_bk.gif' border=0 align=left name='dot_name"+i+"'><DIV id='a"+i+"' style='font: 12px Arial;margin:0;padding-top:0;color:black;padding-bottom:15px;'>&#160;&#160;§ë¼v¤ù&#160;"+i+"</DIV>");
		document.writeln("</td>");	
		//	if ((i % 4) == 0) { document.writeln("</tr>");}


		}

		//				document.writeln("</table>");	    overflow:hidden;
       }	   
	   
function listslide() {
document.writeln("<table border='0' cellspacing='0' cellpadding='0'>");
document.writeln("<tr>");
	for(i=1; i<=AllSlides; i++) {
        if ((i-1 % 5) == 0) { document.writeln("<tr>");}
		document.writeln("<td align='left'>");
		document.writeln("<img src='images/spacer.gif' width='14' height='10' border=0><a href='#"+i+"' onclick='parent.SeekToSlide("+i+");'><img src='sslides/"+i+".jpg' width='80' height='60' border='0' style='padding:0;margin:0'></a><img name='"+i+"' src='images/spacer.gif' width='10' height='10' border='0'>");
		document.writeln("<img src='images/pingan_dot_bk.jpg' border=0 align=left name='dot_name"+i+"'><DIV id='a"+i+"' style='font: 12px Arial;margin:0;padding-top:0;color:black;padding-bottom:15px;'>&#160;&#160;Slide&#160;"+i+"</DIV>");
		document.writeln("</td>");		
				if ((i % 4) == 0) { document.writeln("</tr>");}


		}
						document.writeln("</table>");	
       }
       
       
function ShowSlide(slide_num) {
	if (CurrentSlideNum != slide_num) {
	    document.slide_img.src = slideLocation + Slide[slide_num];
    document.slidenumber = Slide[slide_num];
    if (!NewWindow.closed && NewWindow.location) {
      NewWindow.location.href = lslideLocation + Slide[slide_num];
    }	    
	if (document.getElementById("a1")) {
	
		document.getElementById("a"+slide_num).style.color="#FB6622";
		document.getElementById("dot_name"+slide_num).src= 'images/pingan_dot_og.gif';
		//document.location.href="#"+slide_num;
		document.getElementById('wn').scrollLeft=(110*(slide_num-1));
//        alert(document.getElementById('wn').scrollLeft);
		document.getElementById("a"+CurrentSlideNum).style.color="black";
		document.getElementById("dot_name"+CurrentSlideNum).src= 'images/pingan_dot_bk.gif';
		}
	}
        CurrentSlideNum = slide_num;
        if (document.getElementById("a3")) {
        document.getElementById("a"+slide_num).style.color="#FB6622";
		document.getElementById("dot_name"+slide_num).src= 'images/pingan_dot_og.gif';        
        }
        }


function showName(name_num) {
  if (CurrentNameNum != name_num) {
    document.name_img.src = nameLocation + Name[name_num];
//    document.namenumber = Name[name_num];
  }
  CurrentNameNum = name_num;
}

function showPhoto(photo_num) {
  if (CurrentPhotoNum != photo_num) {
    document.photo_img.src = photoLocation + Photo[photo_num];
//    document.photonumber = Photo[photo_num];
  }
  CurrentPhotoNum = photo_num;
}



function printslide(url)
{
	if (!newwindow14.closed && newwindow14.location)
	{
		newwindow14.location.href = url;
	}
	else
	{ 
	    if (url == "check") {
			url = lslideLocation + Slide[slide_num];}
		var txtConf = 'height=1,width=1,location=0,menubar=0,scrollbars=0,status=0,toolbar=0,top=150,left=150';
		newwindow14=window.open(url,'name3',txtConf);
        newwindow14.focus()
        newwindow14.print();
        //window.print();
   //     alert("hello");
        setTimeout("newwindow14.close();",1250);
		if (!newwindow14.opener) newwindow14.opener = self;
	}
//	if (window.focus) {newwindow4.focus()}
	return false;
}


function showLargeSlide() {
  if (!NewWindow.closed && NewWindow.location) {
    NewWindow.location.href = url;
  } else {  
    NewWindow=window.open(lslideLocation + Slide[CurrentSlideNum],'LargeSlide','height=560,width=740');
    if (!NewWindow.opener) {
      NewWindow.opener = self;
    }
  }
  if (window.focus) {
    NewWindow.focus()
  }
  return false;
}


function ShowTopic(topic_num) {
	if (CurrentTopicNum != topic_num) {
	    document.topic_form.topic_select.options[topic_num - 1].selected = true;
	}
	CurrentTopicNum = topic_num;
}

function nextSlide() {
  if (CurrentSlideNum < (NumOfSlides + 1)) {
//    ShowSlide(CurrentSlideNum + 1);
    seekToTime(rSlideTime[CurrentSlideNum + 1]);
  }
}

function prevSlide() {
  if (CurrentSlideNum > 1) {
//    ShowSlide(CurrentSlideNum - 1);
    seekToTime(rSlideTime[CurrentSlideNum - 1]);
  }
}	


function seekToTime(time) {
  if (navigator.userAgent.indexOf("MSIE") != -1) {
    if (window.bHasWMP7) {
      MediaPlayer1.controls.currentPosition = time;
    } else {
      MediaPlayer1.CurrentPosition = time;
    }
  } else {
    document.MediaPlayer1.SetCurrentPosition(time);
  }
}

function SeekToTopic(topic_num) {
	if (navigator.userAgent.indexOf("MSIE") != -1) {
	    if (window.bHasWMP7) {
		MediaPlayer1.controls.currentPosition = rTopicTime[topic_num];
	    } else {
		MediaPlayer1.CurrentPosition = rTopicTime[topic_num];
	    }
	} else {
	    document.MediaPlayer1.SetCurrentPosition(rTopicTime[topic_num]);
	}
}

function SeekToSlide(slide_num) {
	if (navigator.userAgent.indexOf("MSIE") != -1) {
	    if (window.bHasWMP7) {
		MediaPlayer1.controls.currentPosition = rSlideTime[slide_num];
	    } else {
		MediaPlayer1.CurrentPosition = rSlideTime[slide_num];
	    }
	} else {
	    document.MediaPlayer1.SetCurrentPosition(rSlideTime[slide_num]);
	}
}



function SynEngine() {
	if (navigator.userAgent.indexOf("MSIE") != -1) {
	    if (window.bHasWMP7) {
		position = MediaPlayer1.controls.currentPosition;
	    } else {
		position = MediaPlayer1.CurrentPosition;
	    }
	} else {
	    position = document.MediaPlayer1.GetCurrentPosition();
	}
	for (i = 1; i <= NumOfSlides; i++) {
	    if (position >= rSlideTime[i]) {
		SlideNum = i;
	    }
	}
	
	for (k = 1; k <= NumOfNames; k++) {
	    if (position >= rNameTime[k]) {
		NameNum = k;
	    }
	}	
	
	
	for (m = 1; m <= NumOfPhotos; m++) {
	    if (position >= rPhotoTime[m]) {
		PhotoNum = m;
	    }
	}		
	
	for (j = 1; j <= NumOfTopics; j++) {
	    if (position >= rTopicTime[j]) {
		TopicNum = j;
	    }
	}
	
	ShowSlide(SlideNum);
	showName(NameNum);
//	showPhoto(PhotoNum);	
	ShowTopic(TopicNum);
	slide_num = SlideNum;
	setTimeout("SynEngine()", 1000);
}
