function _WExecuteFunction(mExecFunc){
	eval(mExecFunc);
}
function MakeArray(size){
	this.length = size;
	for(i=0;i<=size;i++)
		this[i] = null;
	return this;

}
function ObjProp(strid,strtype,strobjdesc,strwidth,strheight,strtop,strleft,strzindex,strborder,strsourcepath,strnewwidth,strnewheight,strlight,strdark,strlinkhref,strbackgroundcolor,strmarquebehavior,strmarquedirection,strmarqueloop,strmarquescrolldelay,strmarquescrollamount,strtextfont,strtextsize,strtext1,strtextwithcode,strtextbold,strtextitalic,strtextunderline,strtextcolor,strnewtop,strnewleft,strphotobordername,strfilterglow,strfilterglowcolor,strfilterglowstrength,strfiltershadow,strfiltershadowcolor,strfiltershadowdir,strfiltershadowmov,strfilteralpha,strfilteralphaopacity,strtemplateobjid,strdecorsize,strsourcename,strdestname,strpictquality,strspinobj,strspinobjspeed,strphotosizename,strtextalign,strmarquelooptype,strlinktype,strnewtextcolor,strbgcolorctrl,strlayoutctrl,strbgimgctrl){
	this.id = strid;
	this.type = strtype;
	this.objdesc = strobjdesc;
	this.width = strwidth;
	this.height = strheight;
	this.top = strtop;
	this.left = strleft;
	this.zindex = strzindex;
	this.border = strborder;
	this.sourcepath = strsourcepath;
	this.newwidth = strnewwidth;
	this.newheight = strnewheight;
	this.bordercolorlight = strlight;
	this.bordercolordark = strdark;
	this.linkhref = strlinkhref;
	this.backgroundcolor = strbackgroundcolor;
	this.marquebehavior = strmarquebehavior;
	this.marquedirection = strmarquedirection;
	this.marqueloop = strmarqueloop;
	this.marquescrolldelay = strmarquescrolldelay;
	this.marquescrollamount = strmarquescrollamount;
	this.textfont = strtextfont;
	this.textsize = strtextsize;
	this.text1 = strtext1;
	this.textwithcode = strtextwithcode;
	this.textbold = strtextbold;
	this.textitalic = strtextitalic;
	this.textunderline = strtextunderline;
	this.textcolor = strtextcolor;
	this.newtop = strnewtop;
	this.newleft = strnewleft;
	this.photobordername = strphotobordername;
	this.filterglow = strfilterglow;
	this.filterglowcolor = strfilterglowcolor;
	this.filterglowstrength = strfilterglowstrength;
	this.filtershadow = strfiltershadow;
	this.filtershadowcolor = strfiltershadowcolor;
	this.filtershadowdir = strfiltershadowdir;
	this.filtershadowmov = strfiltershadowmov;
	this.filteralpha = strfilteralpha;
	this.filteralphaopacity = strfilteralphaopacity;
	this.templateobjid = strtemplateobjid;
	this.decorsize = strdecorsize;
	this.sourcename = strsourcename;
	this.destname = strdestname;
	this.pictquality = strpictquality;
	this.spinobj = strspinobj;
	this.spinobjspeed = strspinobjspeed;
	this.photosizename = strphotosizename;
	this.textalign = strtextalign;
	this.marquelooptype = strmarquelooptype;
	this.linktype = strlinktype;
	this.newtextcolor = strnewtextcolor;
	this.bgcolorctrl = strbgcolorctrl;
	this.layoutctrl = strlayoutctrl;
	this.bgimgctrl = strbgimgctrl;
}
function PageProp(strtitle,strbackgroundimage,stralink,strlink,strvlink,strtextcolor,strbgcolor,strmusicname,strmusicplayoption,strphotoborder,strphotoborderw,strbackgroundimagepath,strnewbgimage,strnewbgimagepath,strmusicnamepath,strnewbgcolor,strtemplatetype){
	this.title = strtitle;
	this.backgroundimage = strbackgroundimage;
	this.alink = stralink;
	this.link = strlink;
	this.vlink = strvlink;
	this.textcolor = strtextcolor;
	this.bgcolor = strbgcolor;
	this.musicname = strmusicname;
	this.musicplayoption = strmusicplayoption;
	this.photoborder = strphotoborder;
	this.photoborderw = strphotoborderw;
	this.backgroundimagepath = strbackgroundimagepath;
	this.newbgimage = strnewbgimage;
	this.newbgimagepath = strnewbgimagepath;
	this.musicnamepath = strmusicnamepath;
	this.newbgcolor = strnewbgcolor;
	this.templatetype = strtemplatetype;
}
function LinksProp(strtype,strwidth,strheight,strtop,strleft,strlayer,strpath,strlink,strfont,strfontsize,strsource,strtemplateobjid,strdisplay,strdescription){
	this.type = strtype;
	this.width = strwidth;
	this.height = strheight;
	this.top = strtop;
	this.left = strleft;
	this.layer = strlayer;
	this.path = strpath;
	this.link = strlink;
	this.font = strfont;
	this.fontsize = strfontsize;
	this.source = strsource;
	this.templateobjid = strtemplateobjid;
	this.display = strdisplay;
	this.description = strdescription;
}
function PictCtrlProp(strorderid,strpath,strsource,strheight,strwidth,strsoundpath,strsound,strduration,strtransno,strdurationinf,strtitle,strdate,strcaption,struserdefine1,struserdefine2,stralbumtitle,strplaystatus){
	this.orderid = strorderid;
	this.path = strpath;
	this.source = strsource;
	this.height = strheight;
	this.width = strwidth;
	this.soundpath = strsoundpath;
	this.sound = strsound;
	this.duration = strduration;
	this.transno = strtransno;
	this.durationinf = strdurationinf;
	this.title = strtitle;
	this.date = strdate;
	this.caption = strcaption;
	this.userdefine1 = struserdefine1;
	this.userdefine2 = struserdefine2;
	this.albumtitle = stralbumtitle;
	this.playstatus = strplaystatus;
}
function SlideShowProp(strloop,strplaceholdercolorcheck,strfitplaceholder,strplaystatus){
	this.loop = strloop;
	this.placeholdercolorcheck = strplaceholdercolorcheck;
	this.fitplaceholder = strfitplaceholder;
	this.playstatus = strplaystatus;
}
function ButtonsProp(strid,strdstate,strhstate,strnstate,strsstate,stractivestate){
	this.id = strid;
	this.dstate = strdstate;
	this.hstate = strhstate;
	this.nstate = strnstate;
	this.sstate = strsstate;
	this.activestate = stractivestate;
}
function ConvertLFtoBR(mstring){
	var tempstring=""; var newstring="";
	for(varb=0;varb<=mstring.length;varb++){
		tempstring = mstring.charAt(varb);
		if(tempstring.charCodeAt(0) == 13){ 
		}
		else{
			if(tempstring.charCodeAt(0) == 10){
				newstring = newstring + "<br>";
			}
			else
				newstring = newstring + tempstring;
		}
	}
	return newstring;
}
function ConvertBlank(mstring){
	var tempstring=""; var newstring="";
	for(vara=0;vara<=mstring.length;vara++){
		tempstring = mstring.charAt(vara);
		if(tempstring == " "){
			newstring = newstring + "&nbsp;";
		}
		else{
			if(tempstring == "<"){
				newstring = newstring + "&#60;";
			}
			else{
				newstring = newstring + tempstring;
			}
		}
	}
	return newstring;
}
function ArrowClick(mdirection){
	if(navigator.appName != "Microsoft Internet Explorer"){
		NSArrowClick(mdirection);
		return;
	}

	if(PictCtrlArray[0].orderid == "-1"){
		return;
	}
	var thumbnailW = 96; var thumbnailH = 96; 
	mObjInArray = FindCtrlID("type","Picturesctrl","ObjArray");
	if(mdirection == "down" || mdirection == "right"){
		PictCtrlFirstObj = PictCtrlFirstObj + PictCtrlObjShow;
		if(PictCtrlFirstObj >= PictCtrlArray.length)
			PictCtrlFirstObj = PictCtrlFirstObj - PictCtrlObjShow;
		else
			ResetPictList();
	}
	if(mdirection == "up" || mdirection == "left"){
		PictCtrlFirstObj = PictCtrlFirstObj - PictCtrlObjShow;
		if(PictCtrlFirstObj < 0)
			PictCtrlFirstObj = PictCtrlFirstObj + PictCtrlObjShow;
		else
			ResetPictList();
	}
	if(PictCtrlFirstObj == 0){
		if(ObjArray[mObjInArray].layoutctrl == "horizontal")
			SetButtons("Obj" + mObjInArray + "ImageArrowLeft" ,"d");
		if(ObjArray[mObjInArray].layoutctrl == "vertical" || ObjArray[mObjInArray].layoutctrl == "square")
			SetButtons("Obj" + mObjInArray + "ImageArrowUp" ,"d");
	}
	else{
		if(ObjArray[mObjInArray].layoutctrl == "horizontal")
			SetButtons("Obj" + mObjInArray + "ImageArrowLeft" ,"n");
		if(ObjArray[mObjInArray].layoutctrl == "vertical" || ObjArray[mObjInArray].layoutctrl == "square")
			SetButtons("Obj" + mObjInArray + "ImageArrowUp" ,"n");
	}

	if(PictCtrlFirstObj+PictCtrlObjShow >= PictCtrlArray.length){
		if(ObjArray[mObjInArray].layoutctrl == "horizontal")
			SetButtons("Obj" + mObjInArray + "ImageArrowRight" ,"d");
		if(ObjArray[mObjInArray].layoutctrl == "vertical" || ObjArray[mObjInArray].layoutctrl == "square")
			SetButtons("Obj" + mObjInArray + "ImageArrowDown" ,"d");
	}
	else{
		if(ObjArray[mObjInArray].layoutctrl == "horizontal")
			SetButtons("Obj" + mObjInArray + "ImageArrowRight" ,"n");
		if(ObjArray[mObjInArray].layoutctrl == "vertical" || ObjArray[mObjInArray].layoutctrl == "square")
			SetButtons("Obj" + mObjInArray + "ImageArrowDown" ,"n");
	}
}
function ResetPictList(){
	if(navigator.appName != "Microsoft Internet Explorer"){
		NSResetPictList();
		return;
	}

	var thumbnailW = 96; var thumbnailH = 96; UpdatePict = 0;
	mObjInArray = FindCtrlID("type","Picturesctrl","ObjArray");
	for(mvar=0; mvar < PictCtrlObjShow; mvar++){
		if((PictCtrlFirstObj+mvar) < PictCtrlArray.length){
			newwidth = parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].width); newheight = parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].height);
			if(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].width) > parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].height)){
				newheight = parseFloat(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].height)/(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].width)/thumbnailW));
				if(newheight < 1)
					newheight = 1;
				else
					newheight = parseInt(newheight + 0.5);
				newwidth = thumbnailW;
			}
			else{
				newwidth = parseFloat(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].width)/(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].height)/thumbnailH));
				if(newwidth < 1)
					newwidth = 1;
				else
					newwidth = parseInt(newwidth + 0.5);
				newheight = thumbnailH;
			}
			eval("Obj" + mObjInArray + "TableIC" + (mvar)).borderColor = "ffffff";
			eval("Obj" + mObjInArray + "TableIC" + (mvar)).style.visibility = "visible";
//			eval("Obj" + mObjInArray + "ImageCtrl" + (mvar)).src =  PictCtrlArray[(PictCtrlFirstObj+mvar)].path + PictCtrlArray[(PictCtrlFirstObj+mvar)].source;
			eval("Obj" + mObjInArray + "ImageCtrl" + (mvar)).src =  PictCtrlArray[(PictCtrlFirstObj+mvar)].path + "Tn"+PictCtrlArray[(PictCtrlFirstObj+mvar)].source;
			eval("Obj" + mObjInArray + "ImageCtrl" + (mvar)).width = newwidth;
			eval("Obj" + mObjInArray + "ImageCtrl" + (mvar)).height = newheight;
		}
		else{
			if(mvar < PictCtrlArray.length)
				eval("Obj" + mObjInArray + "TableIC" + (mvar)).style.visibility = "hidden";
		}
		if((PictCtrlFirstObj+mvar) == PictCtrlFocusObj)
			eval("Obj" + mObjInArray + "TableIC" + mvar).borderColor = "00ffff";
	}
}
function Picturesctrlclick(PictureID,mfunction){
	if(navigator.appName != "Microsoft Internet Explorer"){
		NSPicturesctrlclick(PictureID,mfunction);
		return;
	}
//MediaPlayer.SendErrorEvents = false;
	if(PictCtrlArray[0].orderid == "-1"){ 
		return;
	}
	var oldPictCtrlFocusObj = PictCtrlFocusObj;var 	msquarelayout = 0;
	if(mfunction == "next" && SlideShowArray[0].playstatus == "play")
		mfunction = "ss";
	else{
		if(mfunction != "ss"){
			SlideShowArray[0].playstatus = "stop";
		}
	}
	mObjInArray = FindCtrlID("type","Picturesctrl","ObjArray");
	oldPictCtrlFirstObj = PictCtrlFirstObj;
	if((mfunction == "next" || mfunction == "previous"  || mfunction == "ss") && PictCtrlFocusObj < PictCtrlArray.length ){
		for(mfirst=0; mfirst<PictCtrlArray.length; mfirst+=PictCtrlObjShow){
			if(PictCtrlFocusObj >= mfirst)
				PictCtrlFirstObj = mfirst;
		}
		if(PictCtrlFirstObj != oldPictCtrlFirstObj)
			ResetPictList(); 
	}
	if(mfunction == "ss" && SlideShowArray[0].playstatus == "stop"){
		// nothing
		IntervalID = window.setTimeout("",0);
		window.clearInterval(IntervalID);
	}
	else{
		if(PictCtrlFocusObj - PictCtrlFirstObj >= 0 && PictCtrlFocusObj - PictCtrlFirstObj < PictCtrlObjShow ){
			if(eval("Obj" + mObjInArray + "TableIC" + (PictCtrlFocusObj - PictCtrlFirstObj)).style.display == ""){
				eval("Obj" + mObjInArray + "TableIC" + (PictCtrlFocusObj - PictCtrlFirstObj)).borderColor = "ffffff";
			}
		}
	}
	if(PictureID != -1 ){
		PictCtrlFocusObj = PictureID+PictCtrlFirstObj;
	}
	if(mfunction == "next" || (mfunction == "ss" && SlideShowArray[0].playstatus == "play")){
		PictureID = (PictCtrlFocusObj - PictCtrlFirstObj)+1;
		PictCtrlFocusObj = PictCtrlFocusObj + 1;
		if(PictCtrlFocusObj >= PictCtrlArray.length){
			PictureID = PictureID - 1;
			PictCtrlFocusObj = PictCtrlFocusObj - 1;
			if(mfunction == "ss"){
				PictureID = 0;
				PictCtrlFocusObj = 0;
				PictCtrlFirstObj = 0;
				//ArrowClick("up");
				ResetPictList();
			}
		}
		else{
			if(PictureID >= PictCtrlObjShow){
				if(ObjArray[mObjInArray].layoutctrl == "square" || ObjArray[mObjInArray].layoutctrl == "vertical"){
					ArrowClick("down");
				}
				else{
					if(ObjArray[mObjInArray].layoutctrl == "horizontal")
						ArrowClick("right");
				}
				PictureID = 0;
			}
		}
	}
	if(mfunction == "previous"){
		PictureID = (PictCtrlFocusObj - PictCtrlFirstObj)-1;
		PictCtrlFocusObj = PictCtrlFocusObj - 1;
		if(PictCtrlFocusObj < 0){
			PictureID = PictureID + 1;
			PictCtrlFocusObj = PictCtrlFocusObj + 1;
		}
		else{
			if(PictureID < 0){
				if(ObjArray[mObjInArray].layoutctrl == "square" || ObjArray[mObjInArray].layoutctrl == "vertical")
					ArrowClick("up");
				else{
					if(ObjArray[mObjInArray].layoutctrl == "horizontal")
						ArrowClick("left");
				}
				PictureID = PictCtrlObjShow-1;
			}
		}
	}
	if(mfunction == "ss" && SlideShowArray[0].playstatus == "stop"){
		// nothing
	}
	else{
		eval("Obj" + mObjInArray + "TableIC" + PictureID).borderColor = "00ffff";
		eval("Obj" + mObjInArray + "ImageCtrl" + PictureID).src = PictCtrlArray[PictCtrlFocusObj].path + "Tn"+PictCtrlArray[PictCtrlFocusObj].source;
	}
	if(PageArray[0].templatetype == "album"){
		if(mfunction != "init")
			PlaySound('play');
		var mexit = 0;
		for(i=0; i<ObjArray.length && mexit != 1;i++){
			if(ObjArray[i] != null){
				if(ObjArray[i].templateobjid == "title")
					midtitle = i;
				if(ObjArray[i].templateobjid == "date")
					middate = i;
				if(ObjArray[i].templateobjid == "caption")
					midcaption = i;
				if(ObjArray[i].templateobjid == "userdefine1")
					miduserdefine1 = i;
				if(ObjArray[i].templateobjid == "userdefine2")
					miduserdefine2 = i;
				if(ObjArray[i].templateobjid == "albumtitle")
					midalbumtitle = i;
			}
		}
		if(FindCtrlID("templateobjid","title","ObjArray") != -1)
			eval("Obj" + midtitle + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].title;
		if(FindCtrlID("templateobjid","date","ObjArray") != -1)
			eval("Obj" + middate + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].date;
		if(FindCtrlID("templateobjid","caption","ObjArray") != -1)
			eval("Obj" + midcaption + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].caption;
		if(FindCtrlID("templateobjid","userdefine1","ObjArray") != -1)
			eval("Obj" + miduserdefine1 + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].userdefine1;
		if(FindCtrlID("templateobjid","userdefine2","ObjArray") != -1)
			eval("Obj" + miduserdefine2 + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].userdefine2;
		if(FindCtrlID("templateobjid","albumtitle","ObjArray") != -1)
			eval("Obj" + midalbumtitle + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].albumtitle;
	}
	mObjInArray = FindCtrlID("type","Picturesctrl","ObjArray"); // need this here otherwise the text is not working
	eval("Obj" + mObjInArray).style.display = "";
	if(PageArray[0].templatetype == "slideshow" ){
		var mexit = 0;
		for(i=0; i<ObjArray.length && mexit != 1;i++){
			if(ObjArray[i] != null){
				if(ObjArray[i].templateobjid == "title")
					midtitle = i;
				if(ObjArray[i].templateobjid == "date")
					middate = i;
				if(ObjArray[i].templateobjid == "albumtitle")
					midalbumtitle = i;
			}
		}
		if(FindCtrlID("templateobjid","title","ObjArray") != -1)
			eval("Obj" + midtitle + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].title;
		if(FindCtrlID("templateobjid","date","ObjArray") != -1)
			eval("Obj" + middate + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].date;
		if(FindCtrlID("templateobjid","albumtitle","ObjArray") != -1)
			eval("Obj" + midalbumtitle + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].albumtitle;
	}
	msquarelayout = 0;
	if(ObjArray[mObjInArray].layoutctrl == "square"){
		if(mfunction != "init")
			eval("Obj" + mObjInArray).style.display = "none";
		else
			eval("Obj" + mObjInArray).style.display = "";
		msquarelayout = 1;
	}
	mObjInArray = FindCtrlID("type","Placeholderctrl","ObjArray");
	if(msquarelayout){
		if(mfunction != "init")
			eval("Obj" + mObjInArray).style.display = "";
		else
			eval("Obj" + mObjInArray).style.display = "none";
	}
	imgsizeW = parseInt(ObjArray[mObjInArray].newwidth);
	imgsizeH = parseInt(ObjArray[mObjInArray].newheight);
	if(SlideShowArray[0].fitplaceholder == "false"){
		if(parseInt(PictCtrlArray[PictCtrlFocusObj].width) > imgsizeW){
			newheight = parseFloat(parseInt(PictCtrlArray[PictCtrlFocusObj].height)/(parseInt(PictCtrlArray[PictCtrlFocusObj].width)/imgsizeW));
			if(newheight < 1)
				newheight = 1;
			else
				newheight = parseInt(newheight + 0.5);
			newwidth = imgsizeW;
		}
		else{
			newwidth = parseInt(PictCtrlArray[PictCtrlFocusObj].width);
			newheight = parseInt(PictCtrlArray[PictCtrlFocusObj].height);
		}
		if(newheight > imgsizeH){
			newwidth = parseFloat(newwidth/(newheight/imgsizeH));
			if(newwidth < 1)
				newwidth = 1;
			else
				newwidth = parseInt(newwidth + 0.5);
			newheight = imgsizeH;
		}
		else{
			//nothing
		}
	}
	else{
		newheight = parseFloat(parseInt(PictCtrlArray[PictCtrlFocusObj].height)/(parseInt(PictCtrlArray[PictCtrlFocusObj].width)/imgsizeW));
		if(newheight < 1)
			newheight = 1;
		else
			newheight = parseInt(newheight + 0.5);
		newwidth = imgsizeW;
		if(newheight > imgsizeH){
			newwidth = parseFloat(newwidth/(newheight/imgsizeH));
			if(newwidth < 1)
				newwidth = 1;
			else
				newwidth = parseInt(newwidth + 0.5);
			newheight = imgsizeH;
		}
	}
	if(mfunction == "ss" && parseInt(PictCtrlArray[PictCtrlFocusObj].transno) != 77 && SlideShowArray[0].playstatus == "play"){
		var meffect;
		meffect="revealtrans() ";
		eval("Obj" + mObjInArray ).style.filter=meffect;
		if(eval("Obj" + mObjInArray ).filters.item(0).status == 2){
			eval("Obj" + mObjInArray ).filters.item(0).stop();
		}
		eval("Obj" + mObjInArray ).filters.item(0).transition=parseInt(PictCtrlArray[PictCtrlFocusObj].transno);
		eval("Obj" + mObjInArray ).filters.item(0).duration=3; 
		eval("Obj" + mObjInArray ).filters.item(0).apply();
	}
	if(mfunction == "ss" && SlideShowArray[0].playstatus == "stop"){
		// nothing
	}
	else{
		eval("Obj" + mObjInArray + "Image").src = PictCtrlArray[PictCtrlFocusObj].path + PictCtrlArray[PictCtrlFocusObj].source;
		eval("Obj" + mObjInArray + "Image").width = newwidth;
		eval("Obj" + mObjInArray + "Image").height = newheight;
		window.clearInterval(IntervalIDLoad);
		mwaitforimage = "waitforimage(" + mObjInArray + ")";
		IntervalIDLoad = window.setInterval(mwaitforimage,300);
	}
	if(mfunction == "ss" && SlideShowArray[0].playstatus == "play"){
		if(parseInt(PictCtrlArray[PictCtrlFocusObj].transno) != 77)
			eval("Obj" + mObjInArray).filters.item(0).play();
		mtime = 3 * 1050;
		IntervalID2 = window.setTimeout("",0);
		window.clearInterval(IntervalID2);
//		IntervalID2 = window.setTimeout("PlaySound('play')",mtime);
		IntervalID2 = window.setTimeout("PlaySound('play')",0);
		mtime = parseInt(PictCtrlArray[PictCtrlFocusObj].duration);
		window.clearInterval(IntervalID);
		if(PictCtrlArray[PictCtrlFocusObj].durationinf != "true"){
			if(PictCtrlFocusObj == PictCtrlArray.length-1){
				if(SlideShowArray[0].loop != "false"){
					if(parseInt(PictCtrlArray[PictCtrlFocusObj].transno) != 77)
						IntervalID = window.setTimeout("Picturesctrlclick(-1,'ss')",(mtime+3) *1050);
					else
						IntervalID = window.setTimeout("Picturesctrlclick(-1,'ss')",(mtime) *1050);
				}
			}
			else{
				if(parseInt(PictCtrlArray[PictCtrlFocusObj].transno) != 77)
					IntervalID = window.setTimeout("Picturesctrlclick(-1,'ss')",(mtime+3) *1050);
				else
					IntervalID = window.setTimeout("Picturesctrlclick(-1,'ss')",(mtime) *1050);
			}
		}
	}
	mObjInArray = FindCtrlID("type","Buttonsctrl","ObjArray");
	if(PageArray[0].templatetype == "slideshow"){
		if(PictCtrlArray[PictCtrlFocusObj].durationinf == "true")
			SetButtons("Obj" + mObjInArray + "ImageCtrl4" ,"n");
		if(SlideShowArray[0].playstatus == "stop"){
			SetButtons("Obj" + mObjInArray + "ImageCtrl2" ,"n");
			SetButtons("Obj" + mObjInArray + "ImageCtrl3" ,"d");
		}
	}
	if(PictCtrlFocusObj == 0){
		if(PageArray[0].templatetype == "slideshow")
			SetButtons("Obj" + mObjInArray + "ImageCtrl1" ,"d");
		else
			SetButtons("Obj" + mObjInArray + "ImageCtrl2" ,"d");
	}
	else{
		if(PageArray[0].templatetype == "slideshow")
			SetButtons("Obj" + mObjInArray + "ImageCtrl1" ,"n");
		else
			SetButtons("Obj" + mObjInArray + "ImageCtrl2" ,"n");
	}
	if(PictCtrlFocusObj == PictCtrlArray.length - 1){
		if(PageArray[0].templatetype == "slideshow")
			SetButtons("Obj" + mObjInArray + "ImageCtrl4" ,"d");
		else
			SetButtons("Obj" + mObjInArray + "ImageCtrl3" ,"d");
	}
	else{
		if(PageArray[0].templatetype == "slideshow"){
			if(PictCtrlArray[PictCtrlFocusObj].durationinf == "true")
				SetButtons("Obj" + mObjInArray + "ImageCtrl4" ,"n");
		}
		else
			SetButtons("Obj" + mObjInArray + "ImageCtrl3" ,"n");
	}
	mObjInArray = FindCtrlID("type","Picturesctrl","ObjArray");
	if(PictCtrlFirstObj == 0 || PictCtrlFocusObj == 0){
		if(ObjArray[mObjInArray].layoutctrl == "horizontal")
			SetButtons("Obj" + mObjInArray + "ImageArrowLeft" ,"d");
		if(ObjArray[mObjInArray].layoutctrl == "vertical" || ObjArray[mObjInArray].layoutctrl == "square")
			SetButtons("Obj" + mObjInArray + "ImageArrowUp" ,"d");
	}
	else{
		if(ObjArray[mObjInArray].layoutctrl == "horizontal")
			SetButtons("Obj" + mObjInArray + "ImageArrowLeft" ,"n");
		if(ObjArray[mObjInArray].layoutctrl == "vertical" || ObjArray[mObjInArray].layoutctrl == "square")
			SetButtons("Obj" + mObjInArray + "ImageArrowUp" ,"n");
	}
	if(PictCtrlFirstObj+PictCtrlObjShow >= PictCtrlArray.length){
		if(ObjArray[mObjInArray].layoutctrl == "horizontal")
			SetButtons("Obj" + mObjInArray + "ImageArrowRight" ,"d");
		if(ObjArray[mObjInArray].layoutctrl == "vertical" || ObjArray[mObjInArray].layoutctrl == "square")
			SetButtons("Obj" + mObjInArray + "ImageArrowDown" ,"d");
	}
	else{
		if(ObjArray[mObjInArray].layoutctrl == "horizontal")
			SetButtons("Obj" + mObjInArray + "ImageArrowRight" ,"n");
		if(ObjArray[mObjInArray].layoutctrl == "vertical" || ObjArray[mObjInArray].layoutctrl == "square")
			SetButtons("Obj" + mObjInArray + "ImageArrowDown" ,"n");
	}
}
function PlaySound(maction){
	if(navigator.appName != "Microsoft Internet Explorer"){
		return;
	}
	if(maction == "stop"){
		document.MediaPlayer.Cancel();
		document.MediaPlayer.Stop();
		if(navigator.appName == "Microsoft Internet Explorer")
			document.MediaPlayer.FileName = "";
		else
			document.MediaPlayer.src = "";
	}
	else{
		if((PageArray[0].templatetype == "album" || SlideShowArray[0].playstatus != "stop") && maction == "play"){
			if(PictCtrlArray[PictCtrlFocusObj].sound != "" && PictCtrlArray[PictCtrlFocusObj].sound != "no sound" && (document.MediaPlayer.ReadyState == 3 || document.MediaPlayer.ReadyState == 4)){
				document.MediaPlayer.Cancel();
				document.MediaPlayer.Stop();
				if(navigator.appName == "Microsoft Internet Explorer"){
					document.MediaPlayer.FileName = PictCtrlArray[PictCtrlFocusObj].soundpath + PictCtrlArray[PictCtrlFocusObj].sound;
					if(PictCtrlArray[PictCtrlFocusObj].playstatus == "once")
						document.MediaPlayer.PlayCount = 1;
					else
						document.MediaPlayer.PlayCount = 0;
				}
				else{
					document.MediaPlayer.src = PictCtrlArray[PictCtrlFocusObj].soundpath + PictCtrlArray[PictCtrlFocusObj].sound;
					if(PictCtrlArray[PictCtrlFocusObj].playstatus == "once")
						document.MediaPlayer.PlayCount = 1;
					else
						document.MediaPlayer.PlayCount = 0;
				}
			}
			else{
				if(PageArray[0].musicname != "" && PageArray[0].musicname != "no sound" && (document.MediaPlayer.ReadyState == 3 || document.MediaPlayer.ReadyState == 4)){
					if(navigator.appName == "Microsoft Internet Explorer"){
						if(document.MediaPlayer.FileName.substr(document.MediaPlayer.FileName.lastIndexOf("\\")+1) != PageArray[0].musicname && document.MediaPlayer.FileName.substr(document.MediaPlayer.FileName.lastIndexOf("/")+1) != PageArray[0].musicname){
							document.MediaPlayer.Cancel();
							document.MediaPlayer.Stop();
							document.MediaPlayer.FileName = PageArray[0].musicnamepath + PageArray[0].musicname;
							if(PageArray[0].musicplayoption == "once")
								document.MediaPlayer.PlayCount = 1;
							else
								document.MediaPlayer.PlayCount = 0;
						}
					}
					else{
						if(document.MediaPlayer.src.substr(document.MediaPlayer.src.lastIndexOf("\\")+1) != PageArray[0].musicname){
							document.MediaPlayer.Stop();
							document.MediaPlayer.src = PageArray[0].musicnamepath + PageArray[0].musicname;
							if(PageArray[0].musicplayoption == "once")
								document.MediaPlayer.PlayCount = 1;
							else
								document.MediaPlayer.PlayCount = 0;
							if(document.MediaPlayer.src != "")
								document.MediaPlayer.Play();
						}
					}
				}
				else{
					document.MediaPlayer.Cancel();
					document.MediaPlayer.PlayCount = 1;
					document.MediaPlayer.Stop();
				}
			}
		}
	}
}
function Buttonctrlclick(mfunction){
	if(navigator.appName != "Microsoft Internet Explorer"){
		NSButtonctrlclick(mfunction);
		return;
	}

	if(PictCtrlArray[0].orderid == "-1"){ // slide show or album has no valid pictures
		return;
	}
	mObjInArray = FindCtrlID("type","Picturesctrl","ObjArray");
	mButtonsctrl = FindCtrlID("type","Buttonsctrl","ObjArray");
	if(mfunction == "home"){
		if(ObjArray[mObjInArray].layoutctrl == "square"){
			eval("Obj" + mObjInArray).style.display = "";
			mObjInArray=-1; mexit = 0;
			for(vari=0; vari<ObjArray.length && mexit != 1;vari++){
				if(ObjArray[vari] != null){
					if(ObjArray[vari].type == "Placeholderctrl"){
						mObjInArray = vari;
						mexit = 1;
					}
				}
			}
			eval("Obj" + mObjInArray).style.display = "none";
		}
		else{
			PictCtrlFocusObj = 0;
			Picturesctrlclick(0,'previous');
			ResetPictList(); 
		}
	}
	if(mfunction == "play"){
		if(SlideShowArray[0].playstatus != "play"){
			SlideShowArray[0].playstatus = "play";
			PlaySound('play');
			for(mfirst=0; mfirst<PictCtrlArray.length; mfirst+=PictCtrlObjShow){
				if(PictCtrlFocusObj >= mfirst)
					PictCtrlFirstObj = mfirst;
			}
			SetButtons("Obj" + mButtonsctrl + "ImageCtrl2" ,"s");
			SetButtons("Obj" + mButtonsctrl + "ImageCtrl3" ,"n");
			SetButtons("Obj" + mButtonsctrl + "ImageCtrl4" ,"d");
			mtime = parseInt(PictCtrlArray[PictCtrlFocusObj].duration);
			if(PictCtrlArray[PictCtrlFocusObj].durationinf != "true"){
				IntervalID = window.setTimeout("Picturesctrlclick(-1,'ss')",(mtime*1050));

			}
		}
	}
	if(mfunction == "stop"){
//		document.MediaPlayer.Stop();
		IntervalID = window.setTimeout("",0);
		window.clearInterval(IntervalID);
		SetButtons("Obj" + mButtonsctrl + "ImageCtrl2" ,"n");
		SetButtons("Obj" + mButtonsctrl + "ImageCtrl3" ,"d");
		SetButtons("Obj" + mButtonsctrl + "ImageCtrl4" ,"n");
		SlideShowArray[0].playstatus = "stop";
		PlaySound("stop");
//		if(navigator.appName == "Microsoft Internet Explorer")
//			document.MediaPlayer.FileName = '';
//		else
//			document.MediaPlayer.src = '';
	}
	if(mfunction == "previous"){
//		document.MediaPlayer.Stop();
		SlideShowArray[0].playstatus = "stop";
		Picturesctrlclick(-1,'previous');
//		if(navigator.appName == "Microsoft Internet Explorer")
//			document.MediaPlayer.FileName = '';
//		else
//			document.MediaPlayer.src = '';
	}
	if(mfunction == "next"){
		if(SlideShowArray[0].playstatus == "play" && PictCtrlArray[PictCtrlFocusObj].durationinf == "true"){
			Picturesctrlclick(-1,'ss');
			if(PageArray[0].templatetype == "slideshow")
				SetButtons("Obj" + mButtonsctrl + "ImageCtrl4" ,"d");
		}
		else{
			if(SlideShowArray[0].playstatus == "stop"){
				Picturesctrlclick(-1,'next');
				if(PageArray[0].templatetype == "slideshow")
					SetButtons("Obj" + mButtonsctrl + "ImageCtrl4" ,"n");
			}
			else{
				if(PageArray[0].templatetype == "slideshow")
					SetButtons("Obj" + mButtonsctrl + "ImageCtrl4" ,"d");
			}
		}
	}		
}
function SetButtons(mID,mstate){
	if(navigator.appName != "Microsoft Internet Explorer"){
		NSSetButtons(mID,mstate);
		return;
	}

	mObjnum = FindCtrlID("id",mID,"ButtonsArray");
	if(mstate == "d"){
		eval(ButtonsArray[mObjnum].id).src = ButtonsArray[mObjnum].dstate;
		ButtonsArray[mObjnum].activestate = mstate; 
	}
	else{
		if(mstate == "s"){
			eval(ButtonsArray[mObjnum].id).src = ButtonsArray[mObjnum].sstate;
			ButtonsArray[mObjnum].activestate = mstate; 
		}
		else{
			if(mstate == "n"){
				eval(ButtonsArray[mObjnum].id).src = ButtonsArray[mObjnum].nstate;
				ButtonsArray[mObjnum].activestate = mstate; 
			}
		}
	}
}
function FindCtrlID(mfield,mid,marray){
	if(navigator.appName != "Microsoft Internet Explorer"){
		NSFindCtrlID(mfield,mid,marray);
		return;
	}

	var mObjInArray=-1; var mexit = 0;
	for(i=0; i< eval(marray+".length") && mexit != 1;i++){
		if(eval(marray+"[i]") != null){
			if(eval(marray + "[i]." + mfield) == mid){
				mObjInArray = i;
				mexit = 1;
			}
		}
	}
	return mObjInArray;
}
function waitforimage(mObjInArray){
	var temp;
	temp = eval("Obj" + mObjInArray + "Image").readyState;
	if (temp == 'complete'){
		window.clearInterval(IntervalIDLoad);
		//eval("Obj" + mObjInArray + "Image").filters.item(0).play();
	}
}

//
//-------- netscape support starts here --------------------------------------------------------------------------------------------
//
 function dumpout(FirstL,SecondL,writeout,newx,newy) {
 	document.layers[FirstL].document.layers[SecondL].left=newx;
 	document.layers[FirstL].document.layers[SecondL].top=newy;
 	
     document.layers[FirstL].document.layers[SecondL].document.open();
     document.layers[FirstL].document.layers[SecondL].document.write(writeout);
     document.layers[FirstL].document.layers[SecondL].document.close();
     

 }

function outputImgList(objNum, destImg, sourceImg,objIndex,widthImg,heightImg,widthTbl,heightTbl,outputString){

var holderSize=' width='+widthTbl+' height='+heightTbl+' '



if (document.images) {
//var output='<table '+holderSize+'><tr><td align=center valign=center><img  src=' 		+eval(sourceImg).source 		+' height='+heightImg+' width='+widthImg+' onMouseDown=NSPicturesctrlclick('+objIndex+',0)></td></tr></table>'
var emptyout='<table ><tr><td align=center valign=center></td></tr></table>'
	

	if (document.layers) {	
			
		//document.layers['Obj' + objNum].document.images[destImg].src = (eval(sourceImg).path + eval(sourceImg).source); 
		}
	else 
		document.images[destImg].src;
	}
	
		
	if (sourceImg == 0){
	
		document.layers['Obj'+objNum+'ImageCtrl'+objIndex+'b'].document.open();
		document.layers['Obj'+objNum+'ImageCtrl'+objIndex+'b'].document.writeln(emptyout);
		document.layers['Obj'+objNum+'ImageCtrl'+objIndex+'b'].document.close();
	}
	else{
		newx=document.layers['Obj'+objNum].document.images['Obj'+objNum+'ImageCtrl'+objIndex].x-1;
		newy=document.layers['Obj'+objNum].document.images['Obj'+objNum+'ImageCtrl'+objIndex].y-1;
		dumpout('Obj'+objNum,'Obj'+objNum+'ImageCtrl'+objIndex+'b', outputString,newx,newy) 
	}

 
}
	

 function hidelayer(objnum){
    	document.layers[objnum].visibility='hidden';
 }
 
 function showlayer(objnum){
 	document.layers[objnum].visibility='visible';
 }
 

function outputImgMain(objNum, destImg, sourceImg,widthImg,heightImg,widthTbl,heightTbl,outputString){

//table generation
var borsource1= PageArray[0].photoborder;

var borsource2 = borsource1.substring(0, borsource1.length-5)+'2'+ borsource1.substring(borsource1.length-4, borsource1.length)      ;
var borsource3 = borsource1.substring(0, borsource1.length-5)+'3'+ borsource1.substring(borsource1.length-4, borsource1.length)      ;
var borsource4 = borsource1.substring(0, borsource1.length-5)+'4'+ borsource1.substring(borsource1.length-4, borsource1.length)      ;
var borsource5 = borsource1.substring(0, borsource1.length-5)+'5'+ borsource1.substring(borsource1.length-4, borsource1.length)      ;
var borsource6 = borsource1.substring(0, borsource1.length-5)+'6'+ borsource1.substring(borsource1.length-4, borsource1.length)      ;
var borsource7 = borsource1.substring(0, borsource1.length-5)+'7'+ borsource1.substring(borsource1.length-4, borsource1.length)      ;
var borsource8 = borsource1.substring(0, borsource1.length-5)+'8'+ borsource1.substring(borsource1.length-4, borsource1.length)      ;

tmpmObjInArray = NSFindCtrlID("type","Placeholderctrl","ObjArray");

var holderSize=' width='+(widthTbl+4)+' height='+(heightTbl+4)+' '

var output='<table bgcolor='+ObjArray[tmpmObjInArray].bgcolorctrl +' cellpadding=0 cellspacing=0 '+holderSize+'><tr><td align=center valign=center><img name=Obj3Image id=Obj3Image src=' +eval(sourceImg).source +' height='+heightImg+' width='+widthImg+' ></td></tr></table>'

var boutput='<table bgcolor=000000 border=0 id=Obj'+objNum+'DesignBorder  cellspacing=0 cellpadding=0><tr><td ><img id=Obj'+objNum+'db1 src='+borsource1+'></td><td id=Obj'+objNum+'db2 background='+borsource2+'>&nbsp;</td><td ><img id=Obj'+objNum+'db3 src='+borsource3+' ></td></tr><tr><td id=Obj'+objNum+'db8 background='+borsource8+' >&nbsp;</td><td>'+output+'</td><td id=Obj'+objNum+'db4 background='+borsource4+'>&nbsp;</td></tr><tr><td ><img id=Obj'+objNum+'db7 src='+borsource7+'></td><td id=Obj'+objNum+'db6 background='+borsource6+' >&nbsp;</td><td ><img id=Obj'+objNum+'db5 src='+borsource5+' ></td></tr></table>'

//alert(heightTbl);
//alert(heightTbl);

var emptyout='<table '+holderSize+'  ><tr><td align=center valign=center></td></tr></table>'


//alert(destImg);


	if (document.images) {
		if (document.layers) {		
	
		//	document.layers['Obj' + objNum].document.images[destImg].src = (eval(sourceImg).path + eval(sourceImg).source); 
		
			}
		else 
			document.images[destImg].src;
	}

	if (sourceImg == 0){
		document.layers['Obj'+objNum].document.open();
		document.layers['Obj'+objNum].document.writeln(emptyout);
		document.layers['Obj'+objNum].document.close();
	}
	else{
	
			newx=document.layers['Obj'+objNum].document.images['Obj'+objNum+'Image'].x-1;
		newy=document.layers['Obj'+objNum].document.images['Obj'+objNum+'Image'].y-1;
		
		dumpout('Obj'+objNum,'Obj'+objNum+'Imageb', output,newx,newy) 
	
	}
	
//alert(PageArray[0].templatetype);
		
	//output the titles and stuff for the slideshow
	if(PageArray[0].templatetype == "slideshow" ){
		// find the control ID number 
		var mexit = 0;
		for(i=0; i<ObjArray.length && mexit != 1;i++){
			if(ObjArray[i] != null){
				if(ObjArray[i].templateobjid == "title")
					midtitle = i;
				if(ObjArray[i].templateobjid == "date")
					middate = i;
				if(ObjArray[i].templateobjid == "albumtitle")
					midalbumtitle = i;

			}
		}

//alert(midtitle );
//alert(middate );
//alert(midalbumtitle );


//alert( PictCtrlArray[PictCtrlFocusObj].title);
//alert( PictCtrlArray[PictCtrlFocusObj].date);
//alert( PictCtrlArray[PictCtrlFocusObj].albumtitle);


//alert('Obj' + midtitle + 'textwithcodeb');
		if(NSFindCtrlID("templateobjid","title","ObjArray") != -1){
			
			document.layers['Obj' + midtitle ].document.open();
				document.layers['Obj' + midtitle].document.writeln('<table ><tr><td align=center valign=center  class='+'Obj' + midtitle + 'style' + '>' + PictCtrlArray[PictCtrlFocusObj].title+'</td></tr></table>' );				
			document.layers['Obj' + midtitle ].document.close();
		
			//eval("Obj" + midtitle + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].title;
		}
		if(NSFindCtrlID("templateobjid","date","ObjArray") != -1){
			document.layers['Obj' + middate ].document.open();
				document.layers['Obj' + middate ].document.writeln('<table ><tr><td align=center valign=center class='+'Obj' + middate + 'style' + '>' + PictCtrlArray[PictCtrlFocusObj].date+'</td></tr></table>' );				
			document.layers['Obj' + middate].document.close();
			//eval("Obj" + middate + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].date;
		}

		if(NSFindCtrlID("templateobjid","albumtitle","ObjArray") != -1){
			document.layers['Obj' + midalbumtitle ].document.open();
				document.layers['Obj' + midalbumtitle ].document.writeln('<table ><tr><td align=center valign=center class='+'Obj' + midalbumtitle + 'style' + '>' + PictCtrlArray[PictCtrlFocusObj].albumtitle +'</td></tr></table>' );				
			document.layers['Obj' + midalbumtitle  ].document.close();

			//eval("Obj" + midalbumtitle + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].albumtitle;
		}
	}	 
	//output titles for the album



	if(PageArray[0].templatetype == "album"){

		// find the control ID number 
		var mexit = 0;
		for(i=0; i<ObjArray.length && mexit != 1;i++){
			if(ObjArray[i] != null){
				if(ObjArray[i].templateobjid == "title")
					midtitle = i;
				if(ObjArray[i].templateobjid == "date")
					middate = i;
				if(ObjArray[i].templateobjid == "caption")
					midcaption = i;
				if(ObjArray[i].templateobjid == "userdefine1")
					miduserdefine1 = i;
				if(ObjArray[i].templateobjid == "userdefine2")
					miduserdefine2 = i;
				if(ObjArray[i].templateobjid == "albumtitle")
					midalbumtitle = i;
			}
		}
		
		
		if(NSFindCtrlID("templateobjid","title","ObjArray") != -1){
			document.layers['Obj' + midtitle ].document.open();
				document.layers['Obj' + midtitle].document.writeln('<table ><tr><td align=center valign=center class='+'Obj' + midtitle + 'style' + '>' + PictCtrlArray[PictCtrlFocusObj].title+'</td></tr></table>' );				
			document.layers['Obj' + midtitle ].document.close();
			//eval("Obj" + midtitle + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].title;
			}
		if(NSFindCtrlID("templateobjid","date","ObjArray") != -1){
			document.layers['Obj' + middate ].document.open();
				document.layers['Obj' + middate].document.writeln('<table ><tr><td align=center valign=center class='+'Obj' + middate + 'style' + '>' + PictCtrlArray[PictCtrlFocusObj].date +'</td></tr></table>' );				
			document.layers['Obj' + middate ].document.close();
			//eval("Obj" + middate + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].date;
			}
		if(NSFindCtrlID("templateobjid","caption","ObjArray") != -1){
			document.layers['Obj' + midcaption ].document.open();
				document.layers['Obj' + midcaption].document.writeln('<table ><tr><td align=center valign=center class='+'Obj' + midcaption + 'style' + '>' + PictCtrlArray[PictCtrlFocusObj].caption +'</td></tr></table>' );				
			document.layers['Obj' + midcaption ].document.close();
			//eval("Obj" + midcaption + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].caption;
			}
		if(NSFindCtrlID("templateobjid","userdefine1","ObjArray") != -1){
			document.layers['Obj' + miduserdefine1 ].document.open();
				document.layers['Obj' + miduserdefine1 ].document.writeln('<table ><tr><td align=center valign=center class='+'Obj' + miduserdefine1 + 'style' + '>' + PictCtrlArray[PictCtrlFocusObj].userdefine1 +'</td></tr></table>' );				
			document.layers['Obj' + miduserdefine1].document.close();
			//eval("Obj" + miduserdefine1 + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].userdefine1;
			}
		if(NSFindCtrlID("templateobjid","userdefine2","ObjArray") != -1){
			document.layers['Obj' + miduserdefine2 ].document.open();
				document.layers['Obj' + miduserdefine2 ].document.writeln('<table ><tr><td align=center valign=center class='+'Obj' + miduserdefine2 + 'style' + '>' + PictCtrlArray[PictCtrlFocusObj].userdefine2 +'</td></tr></table>' );				
			document.layers['Obj' + miduserdefine2 ].document.close();
			//eval("Obj" + miduserdefine2 + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].userdefine2;
			}
		if(NSFindCtrlID("templateobjid","albumtitle","ObjArray") != -1){
			document.layers['Obj' + midalbumtitle ].document.open();
				document.layers['Obj' + midalbumtitle].document.writeln('<table ><tr><td align=center valign=center class='+'Obj' + midalbumtitle + 'style' + '>' + PictCtrlArray[PictCtrlFocusObj].albumtitle +'</td></tr></table>' );				
			document.layers['Obj' + midalbumtitle ].document.close();			
			
			//eval("Obj" + midalbumtitle + "textwithcode").innerHTML = PictCtrlArray[PictCtrlFocusObj].albumtitle;
			}
	}

		


}
	
function NSplaySlide()	{
	
	
	if (SlideShowArray[0].playstatus == "play"){
		//check the bounds of the image.  If at end of list, reset
		if (PictCtrlFocusObj >= PictCtrlArray.length -1  ){	
			PictCtrlFirstObj = 0;
			PictCtrlFocusObj = 0;
			NSResetPicList();
			NSPicturesctrlclick(0,'');
			var delay=parseInt(PictCtrlArray[PictCtrlFocusObj].duration);
			
					if(parseInt(PictCtrlArray[PictCtrlFocusObj].transno) != 77){
						delay=delay+3;
						}
					
						
			
			setTimeout('NSplaySlide2()', delay *1050);
			}
		else{
		
			
			//display the new images
			
				//update big pic
				
			// repeat sequence
			var delay=parseInt(PictCtrlArray[PictCtrlFocusObj].duration);

				if(parseInt(PictCtrlArray[PictCtrlFocusObj].transno) != 77){
						delay=delay+3;
						}
				setTimeout('NSplaySlide2()', delay*1050);
		}
	}	
	
}	

//NSpicslide
function NSplaySlide2()	{
	
	window.clearInterval(IntervalID);
	if (SlideShowArray[0].playstatus == "play"){
		//check the bounds of the image.  If at end of list, reset
		if (PictCtrlFocusObj >= PictCtrlArray.length -1  ){	
			PictCtrlFirstObj = 0;
			PictCtrlFocusObj = 0;
			NSResetPicList();
			NSPicturesctrlclick(0,'');
			var delay=parseInt(PictCtrlArray[PictCtrlFocusObj].duration);
			
					if(parseInt(PictCtrlArray[PictCtrlFocusObj].transno) != 77){
						delay=delay+3;
						}
					
						
			
			IntervalID = window.setTimeout('NSplaySlide2()', delay *1050);
			}
		else{
		
			
			//display the new images
			
				//update big pic
				NSButtonctrlclick('next');	
			// repeat sequence
			var delay=parseInt(PictCtrlArray[PictCtrlFocusObj].duration);

				if(parseInt(PictCtrlArray[PictCtrlFocusObj].transno) != 77){
						delay=delay+3;
						}
			IntervalID = window.setTimeout('NSplaySlide2()', delay*1050);
		}
	}	
	
}





//NSResetPicList
function NSResetPicList(){
//alert(PictCtrlFirstObj);

// display all the required thumbnails

	var thumbnailW = 96; var thumbnailH = 96; UpdatePict = 0;
	var tblW = 104; var tblH = 104; 
	mObjInArray = NSFindCtrlID("type","Picturesctrl","ObjArray");

	var outputString='';

	for(mvar=0; mvar < PictCtrlObjShow; mvar++){
		if((PictCtrlFirstObj+mvar) < PictCtrlArray.length){			
			// calculate the width and height for the thumbnail
			newwidth = parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].width); newheight = parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].height);
			if(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].width) > parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].height)){
				newheight = parseFloat(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].height)/(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].width)/thumbnailW));
				if(newheight < 1)
					newheight = 1;
				else
					newheight = parseInt(newheight + 0.5);
				newwidth = thumbnailW;
			}
			else{
				newwidth = parseFloat(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].width)/(parseInt(PictCtrlArray[(PictCtrlFirstObj+mvar)].height)/thumbnailH));
				if(newwidth < 1)
					newwidth = 1;
				else
					newwidth = parseInt(newwidth + 0.5);
				newheight = thumbnailH;
			}
			sourceImg="PictCtrlArray[" + (PictCtrlFirstObj + mvar)  + "]";
//			holderSize=' width='+widthTbl+' height='+heightTbl+' ';
	//alert(sourceImg);
			//display changes to the thumbnail array
					if((PictCtrlFirstObj+mvar) == PictCtrlFocusObj){
						borcolour="00ffff";
					}
					else
						borcolour="ffffff";
							
			//outputString=outputString+'<table  height='+thumbnailH+' width='+thumbnailW+'><tr><td align=center valign=center>&nbsp;</td></tr></table>'			
			outputString = '<table border=2  borderColor='+borcolour+' cellpadding=0 cellspacing=0  bgcolor=000000 height='+tblW+' width='+tblW+'><tr><td  align=center valign=center><img   src='+ eval(sourceImg).source+' height='+newheight+' width='+newwidth+' onMouseDown=NSPicturesctrlclick('+ mvar +',0)></td></tr></table> '
			
			outputImgList(mObjInArray, ("Obj" + mObjInArray + "ImageCtrl" + (mvar)),"PictCtrlArray[" + (PictCtrlFirstObj + mvar)  + "]",mvar,newwidth,newheight,tblW,tblH,outputString);				
		}
		else{
			if( mvar < PictCtrlArray.length){
			//holderSize=' width='+widthTbl+' height='+heightTbl+' ';
		
		//outputString = outputString + ' <table  height='+thumbnailH+' width='+thumbnailW+'><tr><td align=center valign=center><img  src='+ eval(sourceImg).source+' height='+newheight+' width='+newwidth+' onMouseDown=NSPicturesctrlclick('+ mvar +',0)></td></tr></table> '
			outputString='<table  cellpadding=0 cellspacing=0  bgcolor=000000  height='+tblW+' width='+tblW+' ><tr><td align=center valign=center>&nbsp;</td></tr></table>'						
		outputImgList(mObjInArray, ("Obj" + mObjInArray + "ImageCtrl" + (mvar)),"PictCtrlArray[" + (PictCtrlFirstObj + mvar)  + "]",mvar,newwidth,newheight,tblW,tblH,outputString);			
		

			}	
			
		
		}
		
		if((PictCtrlFirstObj+mvar) == PictCtrlFocusObj){
		//	outputString=outputString+'<table  height='+thumbnailH+' width='+thumbnailW+'><tr><td align=center valign=center>&nbsp;</td></tr></table>'			
			}
			//eval("Obj" + mObjInArray + "TableIC" + mvar).borderColor = "00ffff";
	}	





}

function NSPicturesctrlclick(PictureID,mfunction){

	
	var oldPictCtrlFocusObj=PictCtrlFocusObj;
	
//picture has been clicked, check the 



	//picture has been clicked, check the 
	if(mfunction == 'next')
	{
		PictCtrlFocusObj++;
		
		//check if it goes beyond bounds
		if(PictCtrlFocusObj < PictCtrlArray.length){
			if ( Math.floor(PictCtrlFocusObj/PictCtrlObjShow) == PictCtrlFirstObj) {
				//alert('the image is on the screen');
				//no need to do anything but display it			
			}
			else
			{				
				//alert('the image is not already on the visible list, increment the arrow and choose the next element');
				PictCtrlFirstObj = Math.floor(PictCtrlFocusObj/PictCtrlObjShow) * PictCtrlObjShow;
				NSArrowClick('');				
			}
		}
		else
		{
			//it goes beyond bounds ignore command
			PictCtrlFocusObj--;
		}
		
		
	}
	
	//picture has been clicked, check the 
	if(mfunction == 'previous')
	{
		PictCtrlFocusObj--;
		
		//check if it goes beyond bounds
		if(PictCtrlFocusObj >=0){
			if ( Math.floor(PictCtrlFocusObj/PictCtrlObjShow) == PictCtrlFirstObj) {
				//alert('the image is on the screen');
				//no need to do anything but display it			
			}
			else
			{				
				//alert('the image is not already on the visible list, increment the arrow and choose the next element');
				PictCtrlFirstObj = Math.floor(PictCtrlFocusObj/PictCtrlObjShow) * PictCtrlObjShow;
				NSArrowClick('');				
			}
		}
		else
		{
			//it goes beyond bounds ignore command
			PictCtrlFocusObj++;
		}
		
		
	}
	
	

	

	if(mfunction == 'init' ){
		PictCtrlFocusObj=PictCtrlFirstObj+PictureID;


	}


	if(mfunction == '0' ){
		PictCtrlFocusObj=PictCtrlFirstObj+PictureID;
		
	}

	if(mfunction == '' ){
	
		PictCtrlFocusObj=PictCtrlFirstObj+PictureID;
		
	}

		
	//bound checking low
	if(PictCtrlFirstObj < 0 ){
		PictCtrlFirstObj = 0;
	}

	//bound checking high
	if((PictCtrlFirstObj + PictureID) > (PictCtrlArray.length )){
		PictCtrlFirstObj = (PictCtrlArray.length - PictCtrlObjShow);
	}		

//now check for titles and other stuff


	
	// find the control ID number of the picturectrl
	mObjInArray = NSFindCtrlID("type","Placeholderctrl","ObjArray");
	
	//alert(PictCtrlFirstObj);

//displaying image
	//////// placeholderctrl ////////

	imgsizeW = parseInt(ObjArray[mObjInArray].newwidth);
	imgsizeH = parseInt(ObjArray[mObjInArray].newheight);

	if(SlideShowArray[0].fitplaceholder == "false"){
		// normal view(actual size). shrink to fit in the window if it's too large
		if(parseInt(PictCtrlArray[PictCtrlFocusObj].width) > imgsizeW){
			newheight = parseFloat(parseInt(PictCtrlArray[PictCtrlFocusObj].height)/(parseInt(PictCtrlArray[PictCtrlFocusObj].width)/imgsizeW));
			if(newheight < 1)
				newheight = 1;
			else
				newheight = parseInt(newheight + 0.5);
			newwidth = imgsizeW;
		}
		else{
			newwidth = parseInt(PictCtrlArray[PictCtrlFocusObj].width);
			newheight = parseInt(PictCtrlArray[PictCtrlFocusObj].height);
		}
		if(newheight > imgsizeH){
			newwidth = parseFloat(newwidth/(newheight/imgsizeH));
			if(newwidth < 1)
				newwidth = 1;
			else
				newwidth = parseInt(newwidth + 0.5);
			newheight = imgsizeH;
		}
		else{
			//newwidth = parseInt(PictCtrlArray[PictureID].width);
			//newheight = parseInt(PictCtrlArray[PictureID].height);
		}
	}
	else{
		// make the small picture "fit to placeholder". make the photo larger than the actual size if placeholder larger than picture
		newheight = parseFloat(parseInt(PictCtrlArray[PictCtrlFocusObj].height)/(parseInt(PictCtrlArray[PictCtrlFocusObj].width)/imgsizeW));
		if(newheight < 1)
			newheight = 1;
		else
			newheight = parseInt(newheight + 0.5);
		newwidth = imgsizeW;
		if(newheight > imgsizeH){
			newwidth = parseFloat(newwidth/(newheight/imgsizeH));
			if(newwidth < 1)
				newwidth = 1;
			else
				newwidth = parseInt(newwidth + 0.5);
			newheight = imgsizeH;
		}
	}
	

	


	
	outputImgMain(mObjInArray, ("Obj" + mObjInArray + "Image"),("PictCtrlArray[" + PictCtrlFocusObj  + "]"),newwidth,newheight,imgsizeW,imgsizeH);		
	NSResetPicList();
		if(ObjArray[mObjInArray].layoutctrl == "square"&& (mfunction != 'init') ){
			mObjInArray = NSFindCtrlID("type","Picturesctrl","ObjArray");
			mPlacectrl = NSFindCtrlID("type","Placeholderctrl","ObjArray");
		
			showlayer('Obj'+mPlacectrl);
			hidelayer('Obj'+mObjInArray);
			
			
			}

				if(ObjArray[mObjInArray].layoutctrl == "square" && (mfunction == 'init')){
						
				mThmInArray = NSFindCtrlID("type","Picturesctrl","ObjArray");
				
				mPlacectrl = NSFindCtrlID("type","Placeholderctrl","ObjArray");
				hidelayer('Obj'+mPlacectrl);
				showlayer('Obj'+mThmInArray);

				}		
}


function NSArrowClick(mdirection){
	var mObjInArray;	
	
	
	//find out where you're showing it
	mObjInArray = NSFindCtrlID("type","Picturesctrl","ObjArray");
	
	
	//START the user has altered the index, changed index appropriately

	
	if(mdirection == 'right'|| mdirection == "down" ){
		PictCtrlFirstObj = PictCtrlFirstObj + PictCtrlObjShow;			
	}	
	if(mdirection == 'left' || mdirection == "up" ){
		PictCtrlFirstObj = PictCtrlFirstObj - PictCtrlObjShow ;
	
	}
	if(mdirection == '' ){
		
		//do nothing but update the thumbnail
	}
	//END the user has altered the index, changed index appropriately
	
	//bound checking low
	if(PictCtrlFirstObj <= 0 ){
		PictCtrlFirstObj = 0;
	}

	//bound checking high
	if(PictCtrlFirstObj >= (PictCtrlArray.length)){
	
		PictCtrlFirstObj = (PictCtrlFirstObj - PictCtrlObjShow);
		
	}
	
	
		
	//display changes to the thumbnail array
	
	NSResetPicList();
	//document.write(getProperties(document.eval("Obj" + mObjInArray + "ImageCtrl" + 0)));	
}


function NSFindCtrlID(mfield,mid,marray){
	// find the control ID number
	var mObjInArray=-1; var mexit = 0;
	for(i=0; i< eval(marray+".length") && mexit != 1;i++){
		if(eval(marray+"[i]") != null){
			if(eval(marray + "[i]." + mfield) == mid){
				mObjInArray = i;
				mexit = 1;
			}
		}
	}
	return mObjInArray;
}



function NSButtonctrlclick(mfunction){
	mObjInArray = NSFindCtrlID("type","Picturesctrl","ObjArray");
	mButtonsctrl = NSFindCtrlID("type","Buttonsctrl","ObjArray");
	mPlacectrl = NSFindCtrlID("type","Placeholderctrl","ObjArray");
	if(mfunction == "home"){


		if(ObjArray[mObjInArray].layoutctrl == "square"){
  
			//eval("Obj" + mObjInArray).style.display = "none";
				hidelayer('Obj'+mPlacectrl);
				showlayer('Obj'+mObjInArray);

		}
		else{
			//reset the counter
			PictCtrlFocusObj =0;			
			PictCtrlFirstObj = 0;
			//display changes
			NSPicturesctrlclick(PictCtrlFocusObj % PictCtrlObjShow,'');		
		}

	}
		
	if(mfunction == 'next'){
			NSPicturesctrlclick(PictCtrlFocusObj % PictCtrlObjShow,'next');
	}	

	if(mfunction == "previous"){
			SlideShowArray[0].playstatus = "stop";
			NSPicturesctrlclick(PictCtrlFocusObj % PictCtrlObjShow,'previous');
	}

	if(mfunction == "play"){
		//make sure it's not already running
		document.MediaPlayer.Play()
		if (SlideShowArray[0].playstatus != "play"){
			SlideShowArray[0].playstatus = "play";
			NSplaySlide();
		}
	}

	if(mfunction == "stop"){
			document.MediaPlayer.Stop()
			SlideShowArray[0].playstatus = "stop";		
	}
		
	


}