// This code is copyrighted ©Copyright 2006 Christian MySpace Codes
// All Rights Reserved
// Use of this code is not allowed under any circumstances!

function update_code()
{
    var disp = document.getElementById("display_code");		
    disp.innerHTML = gen_code();
}

function gen_code()
{
	var myspace_layout = document.getElementById("myspace_layout");	
	str = "";
	styles = "";
	mid = document.getElementById("mid");
	bodybg = document.getElementById("bodybg");
	bodybackground = document.getElementById("bodybackground");
	bodypa = document.getElementById("bodypa"); 
	bodybs = document.getElementById("bodybs"); 
	bodybc = document.getElementById("bodybc"); 
	bodybcs = document.getElementById("bodybcs"); 
	bodyIMPos = document.getElementById("bodyIMPos"); 
	bodyIMRepeat = document.getElementById("bodyIMRepeat"); 
	bodyIMScroll = document.getElementById("bodyIMScroll"); 
	bodyfw = document.getElementById("bodyfw"); 
	bodyfs = document.getElementById("bodyfs"); 
	bodyfc = document.getElementById("bodyfc"); 
	bodyfsize = document.getElementById("bodyfsize"); 
	bodyfd = document.getElementById("bodyfd"); 
	scbc = document.getElementById("scbc"); 
	
	tablebg = document.getElementById("tablebg"); 
	tablebackground = document.getElementById("tablebackground");
	tablepa = document.getElementById("tablepa");
	tablespa = document.getElementById("tablespa");
	tablebs = document.getElementById("tablebs");
	tablebc = document.getElementById("tablebc");
	tableopacity = document.getElementById("tableopacity");
	tablebcs = document.getElementById("tablebcs");
	
	thbg = document.getElementById("thbg"); 
	thbackground = document.getElementById("thbackground");
	thpa = document.getElementById("thpa");
	thsp = document.getElementById("thsp");
	thbs = document.getElementById("thbs");
	tdbc = document.getElementById("tdbc");
	tdbcS = document.getElementById("tdbcS");
	thfw = document.getElementById("thfw"); 
	thfs = document.getElementById("thfs"); 
	thfc = document.getElementById("thfc"); 
	thfsize = document.getElementById("thfsize"); 
	thfd = document.getElementById("thfd"); 
	
	linkbg = document.getElementById("linkbg"); 
	linkfw = document.getElementById("linkfw"); 
	linkfs = document.getElementById("linkfs"); 
	linkfc = document.getElementById("linkfc"); 
	linkfsize = document.getElementById("linkfsize"); 
	linkfd = document.getElementById("linkfd"); 
	
	hoverbg = document.getElementById("hoverbg"); 
	hoverfw = document.getElementById("hoverfw"); 
	hoverfs = document.getElementById("hoverfs"); 
	hoverfc = document.getElementById("hoverfc"); 
	hoverfsize = document.getElementById("hoverfsize"); 
	hoverfd = document.getElementById("hoverfd"); 
	
	visitedbg = document.getElementById("visitedbg"); 
	visitedfw = document.getElementById("visitedfw"); 
	visitedfs = document.getElementById("visitedfs"); 
	visitedfc = document.getElementById("visitedfc"); 
	visitedfsize = document.getElementById("visitedfsize"); 
	visitedfd = document.getElementById("visitedfd"); 
	
	styles = "body {background-color: " + bodybg.value + ";margin: " + bodypa.value + ";border-color: " + bodybc.value + ";border-style: " + bodybcs.value + ";border-width: " + bodybs.value + ";background-image: url(" + bodybackground.value + ");background-position: " + bodyIMPos.value + ";background-repeat: " + bodyIMRepeat.value + "; background-attachment: " + bodyIMScroll.value + ";}body, div, p, strong, td, .text, .blacktext10, .blacktext12, a.searchlinkSmall, a.searchlinkSmall:link, a.searchlinkSmall:visited {font-family: " + bodyfs.value + ";font-size: " + bodyfsize.value + ";font-weight: " + bodyfw.value + ";color: " + bodyfc.value + ";text-decoration: " + bodyfd.value + ";scrollbar-base-color: " + scbc.value + ";}Table, Td { background-color:transparent; border-style:none; }table table td { width:auto; }table table table table td { width:auto; }table table table table{ background-image:none; background-color:transparent; border-style:none; }table table table {background-color: " + tablebg.value + ";background-image: url(" + tablebackground.value + ");opacity: " + tableopacity.value/100 + ";filter: alpha(opacity=" + tableopacity.value + ");padding: " + tablepa.value + " " + tablepa.value + " " + tablepa.value + " " + tablepa.value + ";border-spacing: " + tablespa.value + ";border-width: " + tablebs.value + ";border-style: " + tablebcs.value + ";border-color: " + tablebc.value + ";font-family: " + bodyfs.value + ";font-size: " + bodyfsize.value + ";font-weight: " + bodyfw.value + ";color: " + bodyfc.value + ";text-decoration: " + bodyfd.value + ";}th, .orangetext15, .lightbluetext8, .whitetext12, .nametext, .btext, .redtext, .redbtext {background-color: " + thbg.value + ";background-image:url(" + thbackground.value + ");padding:  " + thpa.value + " " + thpa.value + " " + thpa.value + " " + thpa.value + ";border-spacing: " + thsp.value + ";font-family: " + thfs.value + ";font-size: " + thfsize.value + ";font-weight: " + thfw.value + ";color: " + thfc.value + ";text-decoration: " + thfd.value + ";}a, a:link, a.navbar, a.navbar:link, a.man, a.man:link {font-family: " + linkfs.value + ";font-size: " + linkfsize.value + ";font-weight: " + linkfw.value + ";color: " + linkfc.value + ";text-decoration: " + linkfd.value + ";}a:hover, a:active, a.navbar:hover, a.navbar:active, a.man:hover, a.man:active, a.searchlinkSmall:hover, a.searchlinkSmall:active {font-family: " + hoverfs.value + ";font-size: " + hoverfsize.value + ";font-weight: " + hoverfw.value + ";color: " + hoverfc.value + ";text-decoration: " + hoverfd.value + ";}a:visited, a.navbar:visited, a.man:visited {font-family: " + visitedfs.value + ";font-size: " + visitedfsize.value + ";font-weight: " + visitedfw.value + ";color: " + visitedfc.value + ";text-decoration: " + visitedfd.value + ";}";

	
	str += "<textarea name='text_code' cols=60 rows=5 style='border-style:dashed' onclick='this.select()'><style type'text/css'>" + styles + "</style>";	
	
	str += "<div style='position: absolute; left:0px; top:0px; width:100px; height:60px; z-index:9;'><a href='http://www.christianmyspacecodes.com' title='Myspace Layouts'><img src='http://www.christianmyspacecodes.com/images/myspace_layout.gif' alt='Christian Myspace Layouts' border='0' /></a></div>I edited my profile at <a href='http://www.christianmyspacecodes.com/' title='Christian Myspace Codes' target='_blank'>http://www.christianmyspacecodes.com</a><br /><a href='http://www.dittytalk.com/' title='Christian Myspace' target='_blank'>Christian Myspace</a>";
	str += "</textarea>";
	
if (mid.value!="")
{

	str += "<br /><br /><br /><center><font size='+2'><b>MySpace Preview:</b></font>&nbsp;&nbsp;<br /><br /><iframe scrolling='auto' frameborder='1' width='800' height='350' src='http://www.christianmyspacecodes.com/includes/preview_myspace_l.php' style=\"" + styles + "\"></iframe><br /><br /><br /><font size='+2'><b>Ditty Talk Preview:</b></font>&nbsp;&nbsp;<br /><br /><iframe scrolling='auto' frameborder='1' width='800' height='350' src='http://www.christianmyspacecodes.com/includes/preview_dittytalk_l.php'>" + styles + "</iframe><br /><br /></center>";
}

    return str;
}