var nav1 = ["services", "resources", "customers", "awards", "corporate"];
var nav2 = [];
nav2.push({code:"index", name:"Home"});
nav2.push({code:"sitemap", name:"Site Map"});
nav2.push({code:"careers", name:"Careers"});
nav2.push({code:"contactus", name:"Contact Us"});
nav2.push({code:"clientlogin", name:"Client Log-In"});
var nav1string = nav1.join("|");

document.writeln("<link rel='stylesheet' type='text/css' href='style_colourscan.css'>");
var level = 1;
if (section != "index") {
	level = 2;
}
document.writeln("<style>");
document.writeln(".content_table { background: url(images/content_bkgd_level" + level + ".gif) }");
document.writeln(".content_rightcolbottom { background: url(images/content_rightcolbottomcurve_level" + level + ".gif) no-repeat bottom; }");
if (section == "index") {
	document.writeln(".index_rightcolbottom { background: url(images/home_colourscanwork_bkgd.jpg) no-repeat left bottom;}");
	document.writeln(".content_leftcoltop { background: url(images/content_leftcoltopcurve_level" + level + ".gif) no-repeat top; padding: 10px 20px 0px 10px; }");
	document.writeln(".content_leftcolbottom { background: url(images/content_leftcolbottomcurve_level" + level + ".gif) no-repeat bottom; padding: 10px 10px 0px 10px; }");
	document.writeln(".content_rightcoltop { background: url(images/content_rightcoltopcurve_level" + level + ".gif) no-repeat top; }");
} else {
	document.writeln(".content_leftcoltop { background: url(images/content_leftcoltopcurve_level" + level + ".gif) no-repeat top; padding: 13px 13px 0px 15px; }");
	document.writeln(".content_leftcolbottom { background: url(images/content_leftcolbottomcurve_level" + level + ".gif) no-repeat bottom; }");
	document.writeln(".content_rightcoltop { background: url(images/content_rightcoltopcurve_level" + level + ".gif) no-repeat top; padding: 12px 20px 0px 25px; }");
}
document.writeln("</style>");


url = document.location.toString().split("/");
filename = url[url.length-1].split(".");
fileprefix = filename[0];
breadcrumb = 0;

function generate_header() {
	document.writeln("<table border='0' cellspacing='0' cellpadding='0'>");
	document.writeln("<tr>");
	document.writeln("<td><img src='images/logo_colourscan.gif' width='230' height='35' /></td>");
	document.writeln("<td width='523' align='center' background='images/topnav_curvebkgd.gif'>");
	
	document.writeln("<table border='0' cellspacing='0' cellpadding='0'>");
	document.writeln("<tr>");
	for (var temp=0; temp<nav1.length; temp++) {
		if (temp > 0) {
			document.writeln("<td><img src='images/pixel.gif' width='25' height='1' /></td>");
		}
		var link = nav1[temp];
		switch (link) {
			case "services": link += "_profile"; break;
			case "resources": link += "_equipment"; break;
			case "customers": link += "_publishers"; break;
			case "awards": link += "_intro"; break;
			case "corporate": link += "_history"; break;
		}
		if (link.indexOf(".") == -1) {
			link +=  ".html";
		}
		if (section == nav1[temp]) {
			document.writeln("<td align='right' valign='top'><a href='" + link + "'><img src='images/topnav_" + nav1[temp] + "_on.gif' name='image_topnav_" + nav1[temp] + "' border='0' /></a></td>");
		} else {
			document.writeln("<td>");
			generate_rolleffectsimage("topnav_" + nav1[temp], "gif", "", link, "", "", "", "");
			document.writeln("</td>");
		}
	}
	document.writeln("</tr>");
	document.writeln("</table>");
	
	document.writeln("</td>");
	document.writeln("</tr>");
	
	document.writeln("<tr>");
	document.writeln("<td class='tagline_text'><img src='images/pixel.gif' width='15' height='20' align='absmiddle' />We colour your world - Digitally</td>");
	document.writeln("<td align='right'>");
	for (var temp=0; temp<nav2.length; temp++) {
		var linkstyle = "topnav_link";
		if (section == nav2[temp].code) {
			linkstyle += "selected";
		}
		var link = nav2[temp].code + ".html";
		switch (nav2[temp].code) {
			case "clientlogin": link = "ftp://203.117.10.35' target='_blank"; break;
		}
		document.writeln("<a href='" + link + "' class='" + linkstyle + "'>" + nav2[temp].name + "</a>");
		document.writeln("<img src='images/pixel.gif' width='19' height='1' />");
	}
	document.writeln("</td>");
	document.writeln("</tr>");
	
	document.writeln("</table>");
}

function generate_footer() {
	if (section != "index") {
		document.writeln("<div id='footer'>&copy; Copyright 2005 Colourscan Co Pte Ltd.</div>");
	}
}

function generate_breadcrumb(navtext, navlink) {
	if (breadcrumb == 0) {
		document.writeln("<table width='100%' height='30' border='0' cellspacing='0' cellpadding='0'>");
		document.writeln("<tr><td valign='top' class='breadcrumbs'>");
	} else {
		document.writeln(" &gt; ");
	}
	if (navlink == "") {
		document.writeln(navtext);
	} else if (navlink != "done") {
		document.writeln("<xa href='" + navlink + ".html' class='breadcrumb_link'>" + navtext + "</xa>");
	} else {
		document.writeln(navtext);
		document.writeln("</td></tr>");
		document.writeln("</table>");
	}
	breadcrumb++;
}

function generate_title() {
	document.writeln("<img src='images/" + fileprefix + "_title.gif' />");
}

function generate_intro() {
	document.writeln("<img src='images/" + fileprefix + "_intro.gif' /><br /><br />");
}

function generate_mainpic(picnum) {
	if (picnum != "") {
		picheight = 155;
	} else {
		picheight = 181;
	}
	document.writeln("<img src='images/" + fileprefix + "_mainpic" + picnum + ".jpg' width='142' height='" + picheight + "' /><br /><br />");
}

function generate_banner() {
	document.writeln("<br /><br /><br />");
	document.writeln("<a href='difference_quality.html'><img src='images/banner_colourscan_difference.jpg' width='142' height='89' border='0' /></a>");
}

function generate_contentlistitem(item, link, specialstyle, bullet, topspacing, bottomspacing, liststate) {
	if ((liststate == "startlist") || (liststate == "singleitemlist")) {
		textstyle = "content_text";
		if (specialstyle != "") {
			textstyle = specialstyle;
		}
		document.writeln("<table border='0' cellspacing='0' cellpadding='0' class='" + textstyle + "'>");
	}
	if (link != "") {
		linkstyle = "content_navlink";
		if (specialstyle != "") {
			linkstyle = specialstyle;
		}
		switch (link) {
			default: 
				link = link + ".html";
				break;
		}
		item = "<a href='" + link + "' class='" + linkstyle + "'>" + item + "</a>";
	}
	if (topspacing > 0) {
		document.writeln("<tr><td colspan='2'><img src='images/pixel.gif' width='1' height='" + topspacing + "' /></td></tr>");
	}
	switch (bullet) {
		case "bullet": document.writeln("<tr><td width='10' valign='top'><img src='images/" + bullet + ".gif' width='3' height='3' vspace='5' /></td><td>" + item + "</td></tr>"); break;
		default: document.writeln("<tr><td colspan='2'>" + item + "</td></tr>"); break;
	}
	if (bottomspacing > 0) {
		document.writeln("<tr><td colspan='2'><img src='images/pixel.gif' width='1' height='" + bottomspacing + "' /></td></tr>");
	}
	if ((liststate == "endlist") || (liststate == "singleitemlist")) {
		document.writeln("</table>");
	}
}

function generate_sitemapitem(title, link, itemstyle, indentspace) {
	for (var temp=1; temp<=indentspace; temp++) {
		document.write("&nbsp; ");
	}
	if (link == "") {
		document.writeln("<span class='content_" + itemstyle + "'>" + title + "</span><br />");
	} else {
		if (itemstyle == "link") {
			document.write("<img src='images/bullet_arrow.gif' width='3' height='5' hspace='5' vspace='2' />");
		}
		document.writeln("<a href='" + link + "' class='content_" + itemstyle + "'>" + title + "</a><br />");
	}
}

function generate_home_services() {
	var services = ["imaging", "data", "colour", "printing"];
	document.writeln("<table border='0' cellspacing='0' cellpadding='0'>");
	for (var temp=0; temp<services.length; temp++) {
		if (temp>0) {
			document.writeln("<tr><td colspan='2'><img src='images/pixel.gif' width='1' height='5' /></td></tr>");
		}
		var item = services[temp];
		var rolleffectsparams = "\"home_services_" + item + "_header\", \"gif\", \"\"";
		var rolleffectscode = " onMouseOver='rollon_image(" + rolleffectsparams + "); return true' onMouseOut='rolloff_image(" + rolleffectsparams + "); return true'";
		document.writeln("<tr>");
		document.writeln("<td width='99'><a href='services_" + item + ".html'" + rolleffectscode + "><img src='images/home_services_" + item + "_thumbnail.jpg' width='84' height='39' border='0' /></a></td>");
		document.writeln("<td><a href='services_" + item + ".html'" + rolleffectscode + "><img src='images/home_services_" + item + "_header_off.gif' name='image_home_services_" + item + "_header' border='0' /></a></td>");
		document.writeln("</tr>");
	}
	document.writeln("</table>");
}

function generate_home_colourscanwork(item, spacing) {
	generate_rolleffectsimage("home_colourscanwork_" + item, "gif", "", "customers_" + item + ".html", "", "", "", "");
	document.writeln("<img src='images/pixel.gif' width='1' height='" + spacing + "' /><br />");
}

function generate_resources_equipment(equipment, quantity, liststate) {
	var cellstyle = "contenttablecell_resources_equipment";
	if ((liststate == "startlist") || (liststate == "singleitemlist")) {
		rowcount = 1;
		document.writeln("<table width='100%' border='0' cellspacing='0' cellpadding='0' class='content_text'>");
		document.writeln("<tr class='content_textheaderdarkgrey'><td class='contenttableheader_resources_equipment'>Equipment</td><td class='" + cellstyle + "' align='right'>Quantity</td></tr>");
	}
	var tablerowcode = "<td class='" + cellstyle + "'>" + equipment + "</td><td class='" + cellstyle + "' align='right'>" + quantity + "</td>";
	if (rowcount % 2 == 0) {
		tablerowcode = "<tr>" + tablerowcode + "</tr>";
	} else {
		tablerowcode = "<tr class='contenttable_altrowcolor'>" + tablerowcode + "</tr>";
	}
	document.writeln(tablerowcode);
	rowcount++;
	if ((liststate == "endlist") || (liststate == "singleitemlist")) {
		document.writeln("</table>");
	}
}

function generate_rolleffectsimage(imgname, imgext, imglabel, link, width, height, hspace, vspace) {
	addattribs = "";
	if (width != "") { addattribs += " width='" + width + "'"; };
	if (height != "") { addattribs += " height='" + height + "'"; };
	if (hspace != "") { addattribs += " hspace='" + hspace + "'"; };
	if (vspace != "") { addattribs += " vspace='" + vspace + "'"; };
	rolleffectparams = "\"" + imgname + "\", \"" + imgext + "\", \"" + imglabel + "\"";
	if (imglabel == "") { imglabel = imgname };
	document.writeln("<a href='" + link + "' onMouseOver='rollon_image(" + rolleffectparams + "); return true' onMouseOut='rolloff_image(" + rolleffectparams + "); return true'><img src='images/" + imgname + "_off." + imgext + "' name='image_" + imglabel + "'" + addattribs + " border='0' /></a><br />");
}

function preload_images() {
	if (document.images) {
		for (var temp=0; temp<nav1.length; temp++) {
			eval('image_topnav_' + nav1[temp] + '_on = new Image()');
			eval('image_topnav_' + nav1[temp] + '_on.src = "images/topnav_' + nav1[temp] + '_on.gif"');
		}
		if (section == "index") {
			var services = ["imaging", "data", "colour", "printing"];
			for (var temp=0; temp<services.length; temp++) {
				eval('image_home_services_' + services[temp] + '_on = new Image()');
				eval('image_home_services_' + services[temp] + '_on.src = "images/home_services_' + services[temp] + '_header_on.gif"');
			}
			var colourscanwork = ["publishers", "advertisers", "designers", "printers", "imagers"];
			for (var temp=0; temp<colourscanwork.length; temp++) {
				eval('image_home_colourscanwork_' + colourscanwork[temp] + '_on = new Image()');
				eval('image_home_colourscanwork_' + colourscanwork[temp] + '_on.src = "images/home_colourscanwork_' + colourscanwork[temp] + '_on.gif"');
			}
		}
	}
}

function rollon_image(imgname, imgext, imglabel) {
	if (imglabel == "") { imglabel = imgname };
	document.images["image_" + imglabel].src = "images/" + imgname + "_on." + imgext;
}

function rolloff_image(imgname, imgext, imglabel) {
	if (imglabel == "") { imglabel = imgname };
	document.images["image_" + imglabel].src = "images/" + imgname + "_off." + imgext;
}