function getOffset(width)
{
	var offset = 0;
	var iW = document.body.clientWidth; 
	if(iW > width)
	{
		offset = (iW-width)/2;
	}
	return offset;
}

function initOffsets(elements,contentWidth,dir)
{
	var contentOffset = getOffset(contentWidth);
	var i;
	for(i=0;i < elements.length;++i)
	{ 
		var element = document.getElementById(elements[i][0]);
		if(element)
		{
			if(dir == 'ltr')
			{
				element.style.left = String(elements[i][1]+contentOffset)+'px';
			}
			else
			{
			element.style.right = String(elements[i][1]+contentOffset)+'px';
			}
		}
	}
} 
 			
function openMenu(id)
{
	var sect = document.getElementById(id);
	sect.style.display = "block";
}

function closeMenu(id)
{
	var sect = document.getElementById(id);
	sect.style.display = "none";
}

function enableSearch(text)
{	
	var submit_on = document.getElementById('submit_on');
	var submit_off = document.getElementById('submit_off');	
	
	//if there is some text inserted in the input area,
	//'light on' the search arrow [the picture]
	if(text.value.length > 0)
	{
		submit_off.style.display = "none";
		submit_on.style.display = "inline";
	}
	//else, 'light it off'
	else
	{
		submit_on.style.display = "none";
		submit_off.style.display = "inline";
	}
	
}

function emptySearch(){
	document.search.q.value='';	
}

function switchObj(off,on_id,lang){
	adjustPhotoDesc(lang);
	adjustIcon(on_id, lang);
	off.style.display='none';
	on = document.getElementById(on_id);
	on.style.display='inline';
}

function switchObj2(off_id,on_id){
	off = document.getElementById(off_id);
	off.style.display='none';
	on = document.getElementById(on_id);
	on.style.display='inline';
}

function mailto(login, dept){
	window.open('mailto:'+login+'@'+dept+'.huji.ac.il');
}

function emailPopup(event,login, dept)
{
	var popupBlock = document.getElementById('email_popup');
 	popupBlock.innerHTML = login+'@'+dept+'.huji.ac.il';
	popupBlock.style.left = (event.clientX+f_scrollLeft()+10)+"px";
	popupBlock.style.top = (event.clientY+f_scrollTop()-20)+"px";
	popupBlock.style.display = "block";}

function emailPopupClose()
{
	var popupBlock = document.getElementById('email_popup');
	popupBlock.style.display = "none";
}

function info(login)
{
	url = "info.php?l=" + login;
	window.open(url,'_blank','width=593,height=300,scrollbars=yes,resizable=yes,status=no');
}
function imshow(id, group_id)
{
	
	url = "imshow.php?id=" + id + "&group_id=" + group_id;
	window.open(url,'_blank','width=800,height=600,scrollbars=yes,resizable=yes,status=no');
}
function imshow_url(id, group_id) 
{
    return "imshow.php?id=" + id + "&group_id=" + group_id;
}

function event_imshow(id, group_id)
{
	url = "imshow.php?id=" + id + "&group_id=" + group_id;;
	window.open(url,'_blank','width=1024,height=768,scrollbars=yes,resizable=yes,status=no');
}



function mail(param)
{
	var url = "send_mail.php?mailto=" + param;
	window.open(url, 'mail' ,'width=200,height=100,scrollbars=yes,resizable=yes,status=no');
}
        
var nav = navigator.appName;

function EmailFeed(){
	if(document.forms["mail_form"].elements["sender"].value == ""){
		window.alert("Please enter your name");
		document.forms["mail_form"].elements["sender"].focus();
		return false;
	}

	if(document.forms["mail_form"].elements["e_mail"].value == ""){
		window.alert("Please enter your E-mail");
		document.forms["mail_form"].elements["e_mail"].focus();
		return false;
	}
	if(document.forms["mail_form"].elements["e_mail"].value.indexOf('@',1) == -1 || document.forms		["mail_form"].elements["e_mail"].value.indexOf('.',1) == -1){
		window.alert("Sorry!\n E-mail is not valid!\n Please reenter E-mail");
		document.forms["mail_form"].elements["e_mail"].focus();
		return false;
	}
	if(document.forms["mail_form"].elements["feed"].value == ""){
		window.alert("Please enter your Feedback");
		document.forms["mail_form"].elements["feed"].focus();
		return false;
	}
	if(document.forms["mail_form"].elements["user_code"].value == ""){
		window.alert("Please enter validation code");
		document.forms["mail_form"].elements["user_code"].focus();
		return false;
	}
	

	return true;
}

function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
function openURL(width,height,url)
{
window.open(url,'_blank','width='+width+',height='+height+',scrollbars=no,resizable=no,status=no')
} 
/* version number for IE, -1 for opera, -2 for chrome, 0 for others */
function getBrowser(){
	var ua = window.navigator.userAgent;
   var msie = ua.indexOf ("MSIE ");
   var opera = window.navigator.appName.indexOf("Opera");
   var chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
   if (chrome) return -2;
   var safari = (navigator.userAgent.toLowerCase().indexOf('safari') > -1) || (navigator.userAgent.toLowerCase().indexOf('konqueror') > -1);
   	if (safari) return -3;
   //var bName = navigator.appName;
   //var bVer = parseInt(navigator.appVersion);
   //if (bName == "Microsoft Internet Explorer" && bVer = 7) return 7; 
   if ( msie > 0 )      // If Internet Explorer, return version number
   	return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )));
   if (opera >= 0)       // If opera, return -1
      return -1;
   else						//for others, return 0
   	return 0;
}

function getOs(){
	var strOS = navigator.appVersion;

	//windows
	if (strOS.toLowerCase().indexOf('win') != -1)
		return 1;
	//something else
	else 
		return 0;
}

function adjustPhotoDesc(lang){
	//determine browser
	var browser = getBrowser();
	if (browser <= 0) {
		var part=document.getElementById('foto_desc');
		var offset = '590px';
		if (lang == 'he') 
			//if (browser > 0)
//				offset = '100px';
	//		else
				offset = '250px';
		part.style.marginLeft = offset;		
	}
	else if (browser > 0 && lang == 'he') {
		var part=document.getElementById('foto_desc');
		part.style.marginRight = '-240px';
	}
}

function adjustView(lang){
	var browser = getBrowser();
	//no need for adjustments on english version other than Chrome
	if (lang == 'en' && browser > -2){
		return;
	}	
	adjustIcon('i_icon_off', lang);
	//ie6 on hebrew displays homepage ugly
	var browser = getBrowser();
	if (browser == 6){
		var pan = document.getElementById('panorama');
		if (pan != null){
			pan.style.marginRight = '0px';
			document.getElementById('events_class').style.marginRight = '11px';
		}
	}
}

function adjustIcon(id, lang){
	var browser = getBrowser();
	if (browser > 0 || id.indexOf('i_icon_') == -1)
		return;
		var iIcon = document.getElementById(id);
		if (browser == 0) {
			if (id == "i_icon_on")
				if (lang == 'he')
					iIcon.style.marginRight = '569px';
				else 
					iIcon.style.marginLeft = '569px';
		}
		else if (browser == -1) {
			if (lang == 'he')
				iIcon.style.marginRight = '820px'; 
		}
		else 
			if (browser == -2)
				if (lang == 'he')
					iIcon.style.marginLeft = '195px'; 
				else
					iIcon.style.marginLeft = '569px';
			else 
				if (browser == -3) {
					if (lang == 'he')
						iIcon.style.marginLeft = '200px';
					else
						iIcon.style.marginLeft = '569px';
					}	 
}

function talkViewPast(action, cid){
	if (action=='open'){
	//colloquia
	if (cid == 'clq'){
	    base = 'http://www.cs.huji.ac.il/~collo/colloq-past/';
	    document.getElementById('pastTalk').innerHTML = 
		'<img src="http://www.cs.huji.ac.il/site/images/blue_arrow_down.gif"'+ 		
		' alt=\"[close]\"/>'+
		'<ul class=\"arrow\">'+
		'<li><a href=\"'+base+'index.2007.html\">2006-2007</a></li>'+
		'<li><a href=\"'+base+'index.2006.spring.html\">Spring 2006</a></li>'+
		'<li><a href=\"'+base+'index.2005.winter.html\">Fall 2005</a></li>'+
		'<li><a href=\"'+base+'index.2005.spring.html\">Spring 2005</a></li>'+
		'<li><a href=\"'+base+'index.2004.winter.html\">Fall 2004</a></li>'+
		'<li><a href=\"'+base+'index.2003.winter.html\">Fall 2003</a></li>'+
		'<li><a href=\"'+base+'index.2003.spring.html\">Spring 2003</a></li>'+
		'<li><a href=\"'+base+'index.2002.winter.html\">Fall 2002</a></li>'+
		'<li><a href=\"'+base+'index.2002.spring.html\">Spring 2002</a></li>'+
		'<li><a href=\"'+base+'index.2001.winter.html\">Fall 2001</a></li>'+
		'<li><a href=\"'+base+'index.2001.spring.html\">Spring 2001</a></li>'+
		'<li><a href=\"'+base+'index.2000.winter.html\">Fall 2000</a></li>'+
		'</ul>';
	}
	if (cid == 'ths'){
	    base = 'http://www.cs.huji.ac.il/~theorys/';
	    document.getElementById('pastTalk').innerHTML = 
		'<img src="http://www.cs.huji.ac.il/site/images/blue_arrow_down.gif"'+ 		
		' alt=\"[close]\"/>'+
		'<ul class=\"arrow\">'+
		'<li><a href=\"'+base+'\">2006-2007</a></li>'+
		'<li><a href=\"'+base+'index_2006.html\">2005-2006</a></li>'+
		'<li><a href=\"'+base+'index_2004.html\">2004-2005</a></li>'+
		'<li><a href=\"'+base+'2004/\">2003-2004</a></li>'+
		'<li><a href=\"'+base+'2003/\">2002-2003</a></li>'+
		'<li><a href=\"'+base+'2002/\">2001-2002</a></li>'+
		'<li><a href=\"'+base+'2001/\">2000-2001</a></li>'+
		'<li><a href=\"'+base+'2000/\">1999-2000</a></li>'+
		'<li><a href=\"'+base+'1999/\">1998-1999</a></li>'+
		'<li><a href=\"'+base+'1998/\">1997-1998</a></li>'+
		'<li><a href=\"'+base+'1997/\">1996-1997</a></li>'+
		'<li><a href=\"'+base+'1996/\">1995-1996</a></li>'+
		'<li><a href=\"'+base+'1995/\">1994-1995</a></li>'+
		'</ul>';
	}
	if (cid == 'lrc'){
	    base = 'http://www.cs.huji.ac.il/';
	    document.getElementById('pastTalk').innerHTML = 
		'<img src="http://www.cs.huji.ac.il/site/images/blue_arrow_down.gif"'+ 		
		' alt=\"[close]\"/>'+
		'<ul class=\"arrow\">'+
		'<li><a href=\"'+base+'labs/learning/LearningClub/LearningClubSchedule_2006-2007.html\">2006-2007</a></li>'+
		'<li><a href=\"'+base+'~jkeshet/learning_club.html\">2005-2006</a></li>'+
		'<li><a href=\"'+base+'~gamir\">2004-2005</a></li>'+
		'<li><a href=\"'+base+'~galel/seminar/\">2003-2004</a></li>'+
		'<li><a href=\"'+base+'~galel/seminar/\">2002-2003</a></li>'+
		'<li><a href=\"'+base+'~ranb/seminar/learning_seminar.html\">2001-2002</a></li>'+
		'<li><a href=\"'+base+'~ranb/seminar/learning_seminar.html\">2000-2001</a></li>'+
		'<li><a href=\"'+base+'~ranb/seminar/learning_seminar.html\">1999-2000</a></li>'+
		'</ul>';
	}
	if (cid == 'qrs'){
	    document.getElementById('pastTalk').innerHTML = 
		'<img src="http://www.cs.huji.ac.il/site/images/blue_arrow_down.gif"'+ 		
		' alt=\"[close]\"/>'+
		'<ul class=\"arrow\">'+
		'<li><a href=\"http://www.cs.huji.ac.il/~doria/quantumseminar.2005.html">2005</a></li>' +
		'</ul>';
	}
        if (cid == 'vis'){
	    base = 'http://www.vision.huji.ac.il/visSeminar/';
	    document.getElementById('pastTalk').innerHTML = 
		'<img src="http://www.cs.huji.ac.il/site/images/blue_arrow_down.gif"'+
		' alt=\"[close]\"/>'+
		'<ul class=\"arrow\">'+
		'<li><a href=\"'+base+'\">2002-2010</a></li>'+
		'</ul>';
	}
        document.getElementById('outPastTalk').setAttribute("onclick", 'talkViewPast(\'close\',\''+cid+'\')');
    }
    //else - close
    else{
	//can't use the span's inner html, because of <ul> tag somehow drops it down [unwanted \n]
        document.getElementById('outPastTalk').innerHTML = 'Past Years <span id="pastTalk">'+
	    '<img src="http://www.cs.huji.ac.il/site/images/blue_arrow.gif" '+
	    'alt="[open]"/></span>';
        document.getElementById('outPastTalk').setAttribute("onclick", 'talkViewPast(\'open\',\''+cid+'\')');
    }
}

function changeSms(field){
	var v = field.value;
	if (v != ''){
		document.getElementById('submit').src = 'http://www.cs.huji.ac.il/site/images/send_on.gif';
		document.getElementById('submit').style.cursor="pointer";
		document.getElementById('active').value = 'yes';
	}
	else{
		document.getElementById('submit').src = 'http://www.cs.huji.ac.il/site/images/send_off.gif';
		document.getElementById('active').value = 'no';
		document.getElementById('submit').style.cursor="default";
	}
}

function checkSms(form){
	if (form.active.value == 'yes' && form.user_code.value != '' && form.pass.value != ''){
		return true;
	}
	else{
		alert ('Please fill all the fields.');
		return false;
	}
}
function onFocus(){
	document.getElementById('focusTitle').style.backgroundImage = 'url(http://www.cs.huji.ac.il/site/images/focus_tit2.png)';
}
function offFocus(){
	document.getElementById('focusTitle').style.backgroundImage = 'url(http://www.cs.huji.ac.il/site/images/focus_tit.gif)';
}
function vpWidth() {
	return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
}
function vpHeight() {
	return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
}

/*
function adjustFocus(lang){
	var browser = getBrowser();
	if (browser > 0) return;
	winW = vpWidth();
	var right = (winW-795)/2+180;
	if (lang=='he') {
		document.getElementById('focusTitle').style.marginRight = '420px'
		if (browser == -1) //Opera:
			document.getElementById('focusImg').style.marginLeft = '420px';//TODO:, Chrome & Opera doing problems whit this one.
		else //if FF or IE7
			document.getElementById('focusImg').style.marginRight = '420px';
		document.getElementById('focus_links').style.marginLeft = '-750px';
	}
	else {
			document.getElementById('focusTitle').style.marginLeft = '55px';
	}
}*/
function adjustFocus(lang){
/*	var browser = getBrowser();
	if (lang=='he') {
		if (browser > 0) {
		 	;//document.getElementById('focusTitle').style.marginRight = '4em';
		}
	}
	else {//English
		if (browser <= 0) {
			;//document.getElementById('focusTitle').style.marginLeft = '-1em';
			
		}
		else { 
			//document.getElementById('focus').style.marginRight = '-3.5em'
			//document.getElementById('focusTitle').style.marginLeft = '-1em';
		}
	}
	//if (browser == -1)
		//document.getElementById('focus').style.marginLeft = '380px';
*/
}

function setResearchPopLocation(lang){
	winW = vpWidth();
	var browser = getBrowser();
	document.getElementById('_popup').style.top = "300px";
	if (winW < 795){
		document.getElementById('_popup').style.left = "125px";
	}
	else{
		left = (winW-795)/2+125;
		if (browser == -1 && lang=='he') {//Opera:
			document.getElementById('_popup').style.right = left+"px";//TODO:, Chrome & Opera doing problems whit this one.
			document.getElementById('_popup').style.width = "210px";
			return;		
		}
		if (lang=='he') {
			document.getElementById('_popup').style.right = left+"px";
			document.getElementById('_popup').style.width = "210px";
			return;
		}
		document.getElementById('_popup').style.left = left+"px";
	}
	var ua = window.navigator.userAgent;
	var msie = ua.indexOf ("MSIE ");
   if ( msie > 0 ) {     // If Internet Explorer, return version number
   	msie = parseInt (ua.substring (msie+5, ua.indexOf (".", msie )));
   	if (msie == 6) {
			   document.getElementById('_popup').style.width = 160;
		}
   }
}
/*function stopScroll()
{
 	document.getElementById('marq').stop();
}
function startScroll()
{
	document.getElementById('marq').start();	
}*/

function changeImgToVideo(div_id, video_id){
	id = addZeroes(video_id);
	var newHtml=
		'<object data="http://www.cs.huji.ac.il/site/video/flvplayer.swf?'+
			'video=http://www.cs.huji.ac.il/site/pict/main/'+id+'.flv&amp;startvolume=100&amp;autoplay=true" '+
			'type="application/x-shockwave-flash" width="376" height="277" > '+
			'<param name="movie" value="http://www.cs.huji.ac.il/site/video/flvplayer.swf?'+
			'video=http://www.cs.huji.ac.il/site/pict/main/'+id+'.flv&amp;startvolume=100&amp;autoplay=true" /> '+
			'<param name="allowfullscreen" value="true"/> '+
			'<param name="quality" value="high"> ' +
			'<param name="wmode" value="transparent"> '+
			'<embed src="http://www.cs.huji.ac.il/site/test/flvplayer.swf?'+
			'video=http://www.cs.huji.ac.il/site/pict/main/'+id+'.flv&amp;startvolume=100&amp;autoplay=true" '+
			'quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" '+
			'wmode="transparent" type="application/x-shockwave-flash" width="376" height="277" '+
			'</embed>'+
			'<a href="http://www.cs.huji.ac.il/site/pict/main/'+id+'.flv">link to the video file</a>'+
		'</object> '; 
	document.getElementById('canva').innerHTML = newHtml; 
}
/** Add zeroes if need to complete number to 3 digits. **/
function addZeroes(num) {
	var first = Math.floor(num/10);
	if (first >= 10) return num;
	else {
		if (first >= 1)
			return "0"+num; 
		else
			return "00"+num;
	}
}
      
/***********************************************
* Ultimate Fade-In Slideshow (v1.51): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers

function loadXMLDoc(dname) {
	var xmlDoc;
	if (window.XMLHttpRequest)	{
		xmlDoc=new window.XMLHttpRequest();
		xmlDoc.open("GET",dname,false);
		xmlDoc.send("");
		return xmlDoc.responseXML;
	}
	// IE 5 and IE 6
	else if (ActiveXObject("Microsoft.XMLDOM")) {
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async=false;
		xmlDoc.load(dname);
		return xmlDoc;
	}
	alert("Error loading document");
	return null;
}
//fadeshow(slideshow_width, slideshow_height, borderwidth, delay, pauseOnMouseOver (0=no, 1=yes), optionalRandomOrder, xmlFile)
function fadeshow(fadewidth, fadeheight, borderwidth, delay, pause, displayorder, xmlFile){
	var fadebgcolor="white"
	var xmlDoc =  loadXMLDoc(xmlFile);
	var objNodeList = xmlDoc.getElementsByTagName("image");
	theimages = new Array();
	for (var i=0; i<objNodeList.length; i++) {
		theimages[i]=[objNodeList[i].getElementsByTagName("id")[0].firstChild.data,
			objNodeList[i].getElementsByTagName("title")[0].firstChild.data,
			objNodeList[i].getElementsByTagName("description")[0].firstChild.data,
			(objNodeList[i].getElementsByTagName("video")[0]) ? 1:0,					//Is video 					
			(objNodeList[i].getElementsByTagName("video")[0]) ?
					"javascript:changeImgToVideo(this,"+(i+1)+")" : "javascript:imshow('"+(i+1)+"','main')"] //image with link and target syntax
   }
	this.pausecheck=pause
	this.mouseovercheck=0
	this.delay=delay
	this.degree=10 //initial opacity degree (10%)
	this.curimageindex=0
	this.nextimageindex=1
	fadearray[fadearray.length]=this
	this.slideshowid=fadearray.length-1
	this.canvasbase="canvas"+this.slideshowid
	this.curcanvas=this.canvasbase+"_0";
	if (displayorder=="R")
		theimages.sort(function() {return 0.5 - Math.random();}); //thanks to Mike (aka Mwinter) :)
	this.theimages=theimages
	this.imageborder=parseInt(borderwidth)
	this.postimages=new Array() //preload images
	for (p=0;p<theimages.length;p++){
		this.postimages[p]=new Image()
		this.postimages[p].src="http://www.cs.huji.ac.il/site/pict/main/"+theimages[p][0]+".jpg"
		this.postimages[p].title=theimages[p][1]
		this.postimages[p].description=theimages[p][2]
	}
 
	var fadewidth=fadewidth+this.imageborder*2
	var fadeheight=fadeheight+this.imageborder*2
		
	document.getElementById("canva").innerHTML='<div id="master'+this.slideshowid+
		'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+
		'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+
		fadewidth+'px;height:'+fadeheight+
		'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:'+
		'0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+
		'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+
		'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10)'+
		';opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>';
	this.startit()
}

function fadepic(obj){
	if (obj.degree<100){
		obj.degree+=3
		if (obj.tempobj.filters&&obj.tempobj.filters[0]){
			if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
				obj.tempobj.filters[0].opacity=obj.degree
			else //else if IE5.5-
				obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
		}
		else if (obj.tempobj.style.MozOpacity)
				obj.tempobj.style.MozOpacity=obj.degree/101
			else if (obj.tempobj.style.KhtmlOpacity)
					obj.tempobj.style.KhtmlOpacity=obj.degree/100
				else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
					obj.tempobj.style.opacity=obj.degree/101
	}
	else{
		clearInterval(fadeclear[obj.slideshowid])
		obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
		obj.populateslide(document.getElementById(obj.nextcanvas), obj.nextimageindex)
		obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
		setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
	}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
	var slideHTML=""
        if (this.theimages[picindex][1]!="") { //if associated link exists for image
            slideHTML='<a href='
            //if (this.theimages[picindex][3]) {
            //    slideHTML += '"#"'
            //}
            //else {
                slideHTML += '"'+imshow_url(this.theimages[picindex][0],'main')+'" target="_blank"';
            //}
            slideHTML += ' onclick="'+this.theimages[picindex][4]+'; return false;">'
        }           
        slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px" />'
	if (this.theimages[picindex][1]!="") {//if associated link exists for image
            slideHTML+='</a>' }
	picobj.innerHTML=slideHTML
        /*/
        if (this.theimages[picindex][1]!="") //if associated link exists for image
		slideHTML='<a href="'+this.theimages[picindex][4]+'">'
	slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
	if (this.theimages[picindex][1]!="") //if associated link exists for image
		slideHTML+='</a>'
	picobj.innerHTML=slideHTML
        */         
}
 
fadeshow.prototype.rotateimage=function(){
	if (this.pausecheck==1) //if pause onMouseover enabled, cache object
		var cacheobj=this
	if (this.mouseovercheck==1)
		setTimeout(function(){cacheobj.rotateimage()}, 100)
	else { 
		this.resetit()
		var crossobj=this.tempobj= document.getElementById(this.curcanvas)
		crossobj.style.zIndex++
		fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
		this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
		document.getElementById('image_header').innerHTML = theimages[this.curimageindex][1];
		document.getElementById('image_desc').innerHTML = 
			theimages[this.curimageindex][2].substr(0,420)+
			"<a class='imshow' href=\"javascript:imshow('" + theimages[this.curimageindex][0] + "','main')\">...&#9658;</a>";
		this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
	}
}
 
fadeshow.prototype.resetit=function(){
	this.degree=10
	var crossobj= document.getElementById(this.curcanvas)
	if (crossobj.filters&&crossobj.filters[0]){
		if (typeof crossobj.filters[0].opacity=="number") //if IE6+
			crossobj.filters(0).opacity=this.degree
		else //else if IE5.5-
			crossobj.style.filter="alpha(opacity="+this.degree+")"
	}
	else if (crossobj.style.MozOpacity)
			crossobj.style.MozOpacity=this.degree/101
		else if (crossobj.style.KhtmlOpacity)
				crossobj.style.KhtmlOpacity=this.degree/100
			else if (crossobj.style.opacity&&!crossobj.filters)
					crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
	var crossobj= document.getElementById(this.curcanvas)
	this.populateslide(crossobj, this.curimageindex)
	if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
		var cacheobj=this
		var crossobjcontainer= document.getElementById("master"+this.slideshowid)
		crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
		crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
	}
	this.rotateimage()
}

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var copyspeed=marqueespeed
var actualheight=''

function startScroll() {
	copyspeed=marqueespeed;
}
function stopScroll() {
	copyspeed=0;
}
function scrollmarquee(){
	if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
		cross_marquee.style.top=(parseInt(cross_marquee.style.top)-copyspeed)+"px"
	else
		cross_marquee.style.top=parseInt(marqueeheight)+"px"
}

function initializemarquee(){
	cross_marquee=document.getElementById("vmarquee")
	cross_marquee.style.top=0
	marqueeheight=document.getElementById("marqueecontainer").offsetHeight
	actualheight=cross_marquee.offsetHeight
	lefttime=setInterval("scrollmarquee()",60)
}
function initScroll(){
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
		//cross_marquee.style.height=marqueeheight+"px"
		return
	}
if (window.addEventListener)
	window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
	window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
	window.onload=initializemarquee
}
