$(
	function()
	{
		$("a.cssReportBtn").each(
			function(i)
			{
				$(this).mouseover(
					function()
					{
						$(this).css('cursor','pointer');
					}
				);
				
				$(this).click(
					function()
					{
						//alert($(this).attr('ii'));
						$("#reportform").remove();
						objPanel = $(this).parent().parent().parent().parent();
						objPanel.append("<div id='reportform'><div>");
						
						objReq = new Object();
						objReq.action 	= "forum";
						objReq.exec		= "report";
						objReq.ii		= $(this).attr('ii');
						$("#reportform").load("library/flow/index.php",objReq);
					}
				);
			}
		);
	
		$("div.cssContentPanel div.cssContent div.cssForumMsgBody div.cssBItem").each
		(
			function()
			{	
				objItemS = ($(this).children("div.cssBlockContent").children("div.cssText").children("div.cssTxtSize").children("ul").children("li"));
				objItemS.each
				(
					function(i)
					{
						$(this).click(
							function()
							{
								arySize = ["cssSmall","cssNormal","cssBig"];
								strSize = arySize[i];
								
								if (strSize != "" )
								{
									objItem = ($(this).parent().parent().parent());
									//alert(objItem.html());
									strCC = objItem.attr('pclass');
									if (strCC != "" && strCC != undefined)
									{
										objItem.removeClass(strCC);
									}
									objItem.addClass(strSize);
									objItem.attr('pclass',strSize);
								}
							}
						);
					}
				)
			}
		);
	
		$("div.cssForumInsideBlock div.cssMsgBlock").each(
			function(jj)
			{
				objMsg = $(this).children("div.cssRightBlock");
				
				objMsg.children("input").each(
					function()
					{
						switch ($(this).attr('name'))
						{
							case "vt":
								if ($(this).attr('value') != "" )
								{
									aryImgs = $(this).attr('value').split(";");
									
									if (aryImgs.length > 1 && aryImgs[1] != "")
									{
										//strHtml = "<img src='"+aryImgs[0]+aryImgs[1]+"' />";
										strHtml = "<div class='cssVtPreview' id='vts"+jj+"'>";
										strHtml+= "</div>";
										$(this).parent().append(strHtml);
										
										expressInstallSwfurl = "images/swf/expressInstall.swf";
										obj = new Object();
										obj.wmode = "transparent";
										obj.vtfile = "../../"+aryImgs[0]+aryImgs[1];
										swfobject.embedSWF("images/swf/vtplayer.swf", "vts"+jj , 320 , 240 , '9.0.0.0' , expressInstallSwfurl, obj, obj, obj);
									}								
								}
							break;
							
							case "img":
								if ($(this).attr('value') != "" )
								{
									aryImgs = $(this).attr('value').split(";");
									
									if (aryImgs.length > 1)
									{
										strHtml = "<div class='cssImgPreview'>";
										for (var z=1;z<aryImgs.length;z++)
											if (aryImgs[z] != "")
											{
												strHtml += "<div class='cssImg'><img src='"+aryImgs[0]+aryImgs[z]+"'></div>";
											}
										
										strHtml += "<div class='cssClear'></div></div>";
										//	alert(aryImgs.length);
										if (aryImgs[1] != "")
											$(this).parent().append(strHtml);
											
										$(this).parent().children("div.cssImgPreview").children("div.cssImg").each(
											function ()
											{
												$(this).click( funClickItem );
												$(this).mouseover( function() { $(this).css('cursor' , 'pointer');}  );
												$(this).mouseout( function() { $(this).css('cursor','auto');} );
											}
										);
									}
								}
							break;
						}
					}
				);
			}
		);
	}
);

function funClickItem(e)
{
	if ($(this).children('img').length > 0 )
	{
		var strURL = ($(this).children('img').attr('src'));
		
		$("#overlayermask").remove();
		$("#overlayeritem").remove();
		
		$("body").append("<div id='overlayermask'></div>");
		$("body").append("<div id='overlayeritem'><table><tr><td align='right'><a href='javascript:;' onclick='funCloseItem()'>close</a></td></tr><tr><td><img src='"+strURL+"' width='500'></td></tr></table></div>");
		
		$("#overlayermask").css('background','#cccccc');
		$("#overlayermask").css('opacity' , '0.7');
		$("#overlayermask").css('width',$('body').width());
		$("#overlayermask").css('height',$('body').height() * 1.2);
		$("#overlayermask").css('position','absolute');
		$("#overlayermask").css('top' , 0);
		
		$("#overlayeritem").css('background','#ffffff');
		$("#overlayeritem").css('padding','5px');
		$("#overlayeritem").css('position','absolute');
		$("#overlayeritem").css('display','none');
		$("#overlayeritem").css('top' , $("body").scrollTop() + 100);
		$("#overlayeritem").css('left' , ($('body').width() - 500) / 2 );
		$("#overlayeritem table").css('border-collapse','collapse');
		$("#overlayeritem").show('normal');
	}
}

function funCloseItem()
{
	$("#overlayermask").remove();
	$("#overlayeritem").remove();
}

