﻿// JScript File

function ChangeColor(whatelement)
		    {
		        if (whatelement == "bg")
		        {
		            document.getElementById("ctl00_cphMainContent_bgdiv").style.backgroundColor = "#" + document.getElementById("ctl00_cphMainContent_BackColor").value;
		        }else if (whatelement == "fg")
		        {
		            document.getElementById("ctl00_cphMainContent_bg").style.color = "#" + document.getElementById("ctl00_cphMainContent_ForColor").value;
		        }else if (whatelement == "lc")
		        {
		            document.getElementById("ctl00_cphMainContent_Link1").style.color = "#" + document.getElementById("ctl00_cphMainContent_LinkColor").value;
		            document.getElementById("ctl00_cphMainContent_Link2").style.color = "#" + document.getElementById("ctl00_cphMainContent_LinkColor").value;
		        }
		    }
		    
		    function ChangeSize(whatelement)
		    {
		        if (whatelement == "tf")
		        {
		            document.getElementById("ctl00_cphMainContent_tf").style.fontSize = document.getElementById("ctl00_cphMainContent_TitleSize").value + "pt";
		        }else if (whatelement == "df")
		        {
		            document.getElementById("ctl00_cphMainContent_df").style.fontSize = document.getElementById("ctl00_cphMainContent_DescSize").value + "pt";
		        }else if (whatelement == "bf")
		        {
		            document.getElementById("ctl00_cphMainContent_bf").style.fontSize = document.getElementById("ctl00_cphMainContent_BySize").value + "pt";
		        }
		    }
		    
		    function ChangeBorderSize()
		    {
		        document.getElementById("ctl00_cphMainContent_bgdiv").style.borderWidth = document.getElementById("ctl00_cphMainContent_BorderSize").value + "px";
		        
		    }
		    
		    function ChangeBorderColor()
		    {
		        document.getElementById("ctl00_cphMainContent_bgdiv").style.borderColor = "#" + document.getElementById("ctl00_cphMainContent_BorderColor").value;
		        document.getElementById("ctl00_cphMainContent_bgdiv").style.borderStyle = "solid";
		        
		    }
		    
		    function updatePreview()
		    {
		        ChangeColor("bg");
		        ChangeColor("fg");
		        ChangeColor("lc");
		        ChangeSize("tf");
		        ChangeSize("df");
		        ChangeSize("bf");
		        ChangeBorderSize();
		        ChangeBorderColor();
		        UpdateOutput();
		    }
		    
		    function UpdateOutput()
		    {
		        var theOutput = document.getElementById("ctl00_cphMainContent_Output");
		        theOutput.value = "<script language=javascript>\n ml_sid=\"" + document.getElementById("ctl00_cphMainContent_myUserName").value + "\";\n ";
		        theOutput.value += "ml_width=" + document.getElementById("ctl00_cphMainContent_TableWidth").value + ";\n ";
		        theOutput.value += "ml_backcolor=\"#" + document.getElementById("ctl00_cphMainContent_BackColor").value + "\";\n ";
		        theOutput.value += "ml_forcolor=\"#" + document.getElementById("ctl00_cphMainContent_ForColor").value + "\";\n ";
		        theOutput.value += "ml_linkcolor=\"#" + document.getElementById("ctl00_cphMainContent_LinkColor").value + "\";\n ";
		        theOutput.value += "ml_borderwidth=" + document.getElementById("ctl00_cphMainContent_BorderSize").value + ";\n ";
		        theOutput.value += "ml_bordercolor=\"#" + document.getElementById("ctl00_cphMainContent_BorderColor").value + "\";\n ";
		        theOutput.value += "ml_keyword=\"" + document.getElementById("ctl00_cphMainContent_Keyword").value + "\";\n ";
		        theOutput.value += "ml_numresults=" + document.getElementById("ctl00_cphMainContent_NumResults").value + ";\n ";
		        if (document.getElementById("ctl00_cphMainContent_BoldKeyword").checked == true)
		        {
		            theOutput.value += "ml_boldkeyword=\"yes\";\n ";
		        }else
		        {
		            theOutput.value += "ml_boldkeyword=\"no\";\n ";
		        }
		        theOutput.value += "ml_type=\"" + document.getElementById("ctl00_cphMainContent_Type").value + "\";\n ";
		        theOutput.value += "ml_hfsize=" + document.getElementById("ctl00_cphMainContent_TitleSize").value + ";\n ";
		        theOutput.value += "ml_dfsize=" + document.getElementById("ctl00_cphMainContent_DescSize").value + ";\n ";
		        theOutput.value += "ml_bfsize=" + document.getElementById("ctl00_cphMainContent_BySize").value + ";\n ";
		        theOutput.value += "ml_align=\"" + document.getElementById("ctl00_cphMainContent_bAlign").value + "\";\n ";
		        theOutput.value += "ml_user=\"" + document.getElementById("ctl00_cphMainContent_SpecificUser").value + "\";\n";
		        theOutput.value += "<\/script>\n";
		        theOutput.value += "<script language=javascript src=\"http://feed.mylot.com/feed.js\"><\/script>";
		    }