﻿        function playvideo(ecardId,title,picPath)
        {          
            var container = document.getElementById('divviewecardcontainer');     
            container.style.display = "block";
            var html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	            html += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="640" height="482" id="viewEcard" align="middle"> ';
		            html += '<param name="allowScriptAccess" value="sameDomain" /> ';
		            html += '<param name="movie" value="/DesktopModules/tEcard/Resources/view.swf?ecardId='+ ecardId +'&picPath='+ picPath +'" /> ';
		            html += '<param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> ';
		            html += '<embed src="/DesktopModules/tEcard/Resources/view.swf?ecardId='+ ecardId +'&picPath='+ picPath +'" quality="high" bgcolor="#ffffff" width="640" height="482" name="viewEcard" align="middle"  ';
		            html += 'allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ';
		            html += 'pluginspage="http://www.macromedia.com/go/getflashplayer" /> ';
	            html += '</object> ';	            
//	        var embedded = document.getElementById('embedded');     
//	        embedded.value =html;
            var	divviewecard = document.getElementById('divviewecard');
//            var	marqueetitle = document.getElementById('marqueetitle');            
//            marqueetitle.start();
            var	ecardtitle = document.getElementById('ecardtitle');
            ecardtitle.value = title;
            //container.style.width = document.body.clientWidth;
            container.style.left = (document.body.clientWidth-640)/2;
            //container.style.height = document.body.clientHeight;
            divviewecard.innerHTML  = html;	   
        }    
        function buildecard(userId,cateId)
        {                   
            var urlback = "http://www.ecard.net/Default.aspx";
            //var container = document.getElementById('divbuild');     
            //container.style.display = "block";
            var html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	            html += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1000" height="700" id="buildEcard" align="middle"> ';
		            html += '<param name="allowScriptAccess" value="sameDomain" /> ';
		            html += '<param name="movie" value="/DesktopModules/tEcard/Resources/build.swf?urlback='+ urlback +'&userId='+userId + '" /> ';
		            html += '<param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> ';
		            html += '<embed src="/DesktopModules/tEcard/Resources/build.swf?urlback='+ urlback +'&userId='+userId+'" quality="high" bgcolor="#ffffff" width="1000" height="700" name="buildEcard" align="middle"  ';
		            html += 'allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ';
		            html += 'pluginspage="http://www.macromedia.com/go/getflashplayer" /> ';
	            html += '</object> ';	            
            //var	divbuildecard = document.getElementById('divbuildecard');
            //divbuildecard.innerHTML  = html;	  toolbar=0, location=0, directories=0, status=1, scrollbars=0, resizable=0, copyhistory=0, menuBar=0 
            //width=1000,height=700,resizable=1,fullscreen=1
            myWindow=window.open('','','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0');
            myWindow.document.write(html);
            myWindow.focus();
        }  
        function FloatEcardViewerDiv()
	    {
		    //startX = (document.body.clientWidth - 600)/2, startY = 500;
		    startX = (document.body.clientWidth-640)/2;
		    startY = 10;
		    var ns = (navigator.appName.indexOf("Netscape") != -1);
		    var d = document;
           		
		    function ml(id)
		    {
			    var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
			    if(d.layers)el.style=el;
			    try
			    {
			        el.sP=function(x,y){this.style.left=x;this.style.top=y;};			    
			        el.x = startX;
			        el.y = startY;
			    }catch(ex)
			    {
			    }
			    return el;
		    }
    		
		    window.stayTopLeft=function()
		    {
    					    
			    if (document.documentElement && document.documentElement.scrollTop)
				    var pY = ns ? pageYOffset : document.documentElement.scrollTop;
			    else if (document.body)
				    var pY = ns ? pageYOffset : document.body.scrollTop;

			    //if (document.body.scrollTop > 200){startY = 50} else {startY = 0};
			    startY = 10;
			    try
			    {
			        ftlObj.x  = startX;
			        ftlObj.y += (pY + startY - ftlObj.y)/5;
			        ftlObj.sP(ftlObj.x, ftlObj.y);
		        }catch(ex)
		        {
		        }
			    setTimeout("stayTopLeft()", 10);
		    }
    		
		    ftlObj = ml("divviewecardcontainer");
		    stayTopLeft();
	    }
	    function ShowEcardViewerDiv()
	    {
		    var objEcardViewerDiv  = document.getElementById("divviewecardcontainer");		    
		    if(objEcardViewerDiv!=null)
			objEcardViewerDiv.style.left  = (document.body.clientWidth-640)/2;;			    		    
		    FloatEcardViewerDiv();		    
	    }	    
	    function closeEcardViewerDiv()
	    {
	        //playvideo(-1);	 
	        var objEcardViewerDiv  = document.getElementById("divviewecardcontainer");
	        if(objEcardViewerDiv!=null)
	        objEcardViewerDiv.style.display = "none";
	        var	divviewecard = document.getElementById('divviewecard');
	        divviewecard.innerHTML = "";
	        
	        return false;
	    }
	    function closeBuildDiv()
	    {
	        var objEcardViewerDiv  = document.getElementById("divbuild");
	        if(objEcardViewerDiv!=null)
	        objEcardViewerDiv.style.display = "none";
	        
	        return false;
	    }
        addLoadEvent(ShowEcardViewerDiv);             
