//<![CDATA[
                function docode1(swfid) {
//                        var linktext = '<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyMjIzMjE5MDEzMDQmcHQ9MTIyMjMyMTkwNDU1NyZwPTIzODk4MSZkPSZuPSZnPTEmdD*mbz1kN2MyMGJiNzJkMDk*MmFkOGVjZjhkZjg5OTY4Zjk5YQ==.gif" />';
                        var linktext = '';
                        var thepars = getpars();
                        //var thecode = '<div style="text-align:center;width:100%;height:100%;" />';
                        var thecode = '';
                        thecode += '<div style="margin:0px auto;text-align:center;';
                        thecode += 'width:';
                        thecode += thepars.ww;
                        thecode += 'px;';
                        thecode += 'height:';
                        thecode += thepars.hh;
                        thecode += 'px;';
                        if (!thepars.noalg && thepars.alg != "center") {
                        thecode += 'float:';
                        thecode += thepars.alg;
                        thecode += ';';
                        }
                        thecode += '">';
                        thecode += '<embed src="images/islamiclock_';
						thecode += swfid;
						thecode += '.swf" width="';
                        thecode += thepars.ww;
                        thecode += '" height="';
                        thecode += thepars.hh;
                        thecode += '" flashvars="'
						if (thepars.col) {
						thecode += '&col=';
                        thecode += thepars.col;
						}
						if (thepars.col1) {
                        thecode += '&col1=';
                        thecode += thepars.col1;
						}
						if (thepars.col2) {
                        thecode += '&col2=';
                        thecode += thepars.col2;
						}
						if (thepars.col3) {
                        thecode += '&col3=';
                        thecode += thepars.col3;
						}
						if (thepars.bgo) {
                        thecode += '&bgo=';
                        thecode += thepars.bgo;
						}
						if (thepars.yourtext) {
                        thecode += '&yourtext=';
                        thecode += thepars.yourtext;
						}
						if (thepars.tz) {
                        thecode += '&tzoffset=';
                        thecode += thepars.tz;
						}
						thecode += '" swliveconnect="true" quality="best" loop="false" menu="false" wmode="transparent" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />';
                        thecode += linktext?('<br>'+linktext):'';
                        thecode += '</div>';
                        $('thecode1').value=thecode;
                }

                function docode2(swfid) {
						var linktext = '';
						//var linktext = '<a href="http://al-habib.tripod.com/islamic-clock/" style="font-size:8px;text-decoration:none;"> Free Islamic Clock </a>';
                        var thepars = getpars();
                        //var thecode = '<div style="text-align:center;width:100%;height:100%;" />';
                        var thecode = '';
                        thecode += '<div style="margin:0px auto;text-align:center;';
                        thecode += 'width:';
                        thecode += thepars.ww;
                        thecode += 'px;';
                        thecode += 'height:';
                        thecode += thepars.hh;
                        thecode += 'px;';
                        if (!thepars.noalg && thepars.alg != "center") {
                        thecode += 'float:';
                        thecode += thepars.alg;
                        thecode += ';';
                        }
                        thecode += '">';
                        thecode += '<embed src="';
						thecode += swfid;
						thecode += '" width="';
                        thecode += thepars.ww;
                        thecode += '" height="';
                        thecode += thepars.hh;
                        thecode += '" flashvars="'
						if (thepars.col) {
						thecode += '&col=';
                        thecode += thepars.col;
						}
						if (thepars.col1) {
                        thecode += '&col1=';
                        thecode += thepars.col1;
						}
						if (thepars.col2) {
                        thecode += '&col2=';
                        thecode += thepars.col2;
						}
						if (thepars.col3) {
                        thecode += '&col3=';
                        thecode += thepars.col3;
						}
						if (thepars.bgo) {
                        thecode += '&bgo=';
                        thecode += thepars.bgo;
						}
						if (thepars.yourtext) {
                        thecode += '&yourtext=';
                        thecode += thepars.yourtext;
						}
						if (thepars.tz) {
                        thecode += '&tzoffset=';
                        thecode += thepars.tz;
						}
						thecode += '" swliveconnect="true" quality="best" loop="false" menu="false" wmode="transparent" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />';
                        thecode += linktext?('<br>'+linktext):'';
                        thecode += '</div>';
                        $('thecode2').value=thecode;
                }
						function getpars() {
						//var re = /[ ]/g;
                var pars = {};
								pars.col = "";
								pars.col1 = "";
								pars.col2 = "";
								pars.col3 = "";
								pars.bgo = "";
								pars.yourtext = "";
								pars.tz = "";
								if($('setCol')) pars.col = $('setCol').value;
								if($('setCol1')) pars.col1 = $('setCol1').value;
								if($('setCol2')) pars.col2 = $('setCol2').value;
								if($('setCol3')) pars.col3 = $('setCol3').value;
								if($('setBgo')) pars.bgo = $('setBgo').value;
								if($('setText')) {
								var thetexts = $('setText').value;
								//thetexts = thetext.split(" ");
								thetext = thetexts.replace(/\s/g,"+");
								pars.yourtext = thetext;
								}
								//alert(thetext);
								if($('setTz')) pars.tz = $('setTz').value;
                                pars.ww = $('setW').value;
                                pars.hh = $('setH').value;
                                pars.noalg = $('clearPos').checked;
                                pars.alg = getCheckedValue(document.forms['codegen'].elements['setPos']);
                                //pars.alg = $('setPos').value;
                                return pars;
                        }
                        
                        function setpars() {
                                var thepars = getpars();
                                var fvs = {
                                col : thepars['col']
                                };
                                var flashMovie=getFlashMovieObject("myMov");
                                //SendDataToFlashMovie("col",thepars['col']);
                                SendDataToFlashMovie("dayAdd",thepars['adj']);
                                doswf(".swf","embedPreview",thepars['ww'],thepars['hh'],fvs);
                        }

                        function calcWH(target) {
                        if ($('lockWH').checked) { 
                        if (target == "setH") {
                                $(target).value = Math.round(sh/sw*$('setW').value);
                                }
                        if (target == "setW") {
                                $(target).value = Math.round(sw/sh*$('setH').value);
                                }
                        }
                        }
                        
                        function updatePreview(){
        var userInput = $('thecode1').value;
        $('embedPreview').innerHTML = userInput;
    }