/************************
* PicViewer可移植版 for Site MagicSquare (SiteMagic)
* Coding By Ridge Wong @ 2008-2-16
* Demo Code:
* 	-----------------
*	var t = new SiteMagic.WebUI.PicViewer(507,174);
*	// 1st PicViewer
*	t.DataLoad = function(){
*	return [["/0eab2653b0fc430faf5d057048bc4025.jpg", "/dc0028758060462db3c0c6f5d3544523.jpg"],
*			 ["InfoPreView.aspx?InfoId=13635","InfoPreView.aspx?InfoId=13636"]]; 
*	}
*	t.Display();
*
*	// 2nd
*	t.Reset(200,100);
*	t.Data = [["/0eab2653b0fc430faf5d057048bc4025.jpg", "/dc0028758060462db3c0c6f5d3544523.jpg"],
*			 ["InfoPreView.aspx?InfoId=13635","InfoPreView.aspx?InfoId=13636"]];
*	t.Display();
* 	---------------------
**************************/
if (typeof(SiteMagic.WebUI)=="undefined") {registerNamespace("SiteMagic.WebUI");}
SiteMagic.WebUI.PicViewer = function(){
	var args = arguments, argc = arguments.length;
	if (argc<2 || argc>3) { return; }
	var fw=args[0], fh=args[1];
	this.Reset = function(w,h) {fw=w; fh=h;};
	this.Data = null;
	this.DataLoad = null;
	this.TextHeight = 0;
	this.Dispose = function() { this.Data = null; };
	this.Display = function(){
		var sh = fh + this.TextHeight;
		if (typeof(this.DataLoad)=="function" && this.Data == null) { this.Data = this.DataLoad(); }
		var strPics,strLinks,strTexts;
		if(this.Data instanceof Array)
		{
			if (this.Data.length==3 && this.TextHeight==0) { this.TextHeight = 18;}
			strPics = this.Data[0].join("|");
			strLinks = this.Data[1].join("|");
			strTexts = (this.Data.length==3) ? this.Data[2].join("|") : "";
		}
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ fw +'" height="'+ sh +'">');
		document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/Templet/Common/PicViewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#F1ECE5">');
		document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
		document.write('<param name="FlashVars" value="Pics='+strPics+'&Links='+strLinks+'&Texts='+strTexts+'&borderwidth='+fw+'&borderheight='+(fh-this.TextHeight)+'&textheight='+this.TextHeight+'">');
		document.write('<embed src="/Templet/Common/PicViewer.swf" wmode="opaque" FlashVars="strPics='+strPics+'&strLinks='+strLinks+'&strTexts='+strTexts+'&borderwidth='+fw+'&borderheight='+(fh-this.TextHeight)+'&textheight='+this.TextHeight+'" menu="false" bgcolor="#F1ECE5" quality="high" width="'+ fw +'" height="'+ sh +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	};
};
