function loadFlash(file, w, h, base, flashVars) {
	document.writeln(getFlashOutput(file, w, h, base, flashVars));
}
function loadFlashSEO(tag, file, w, h, base, flashVars) {	
	document.getElementsByTagName(tag)[0].innerHTML = getFlashOutput(file, w, h, base, flashVars + "&text=" + document.getElementsByTagName(tag)[0].innerHTML);
}
function getFlashOutput(file, w, h, base, flashVars) {
	var output = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""+
		"	codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0\""+
		"	width=\""+w+"\""+
		"	height=\""+h+"\""+
		"	name=\"flashFile\""+
		"	id=\"flashFile\">"+
		"	<param name=\"movie\" value=\""+file+"\">"+
		"	<param name=\"base\" value=\""+base+"\">"+
		"	<param name=\"flashVars\" value=\""+flashVars+"\">"+
		"	<param name=\"quality\" value=\"high\">"+
		"	<param name=\"menu\" value=\"false\">"+
		"	<param name=\"wmode\" value=\"transparent\">"+
		"	<embed"+
		"		src=\""+file+"\""+
		"		base=\""+base+"\""+
		"		width=\""+w+"\""+
		"		height=\""+h+"\""+
		"		flashVars=\""+flashVars+"\""+
		"		quality=\"high\""+
		"		pluginspage=\"http://www.macromedia.com/go/getflashplayer\""+
		"		type=\"application/x-shockwave-flash\""+
		"		menu=\"false\""+
		"		wmode=\"transparent\""+
		"		swLiveConnect=\"true\""+
		"		name=\"flashFile\">"+
		"	</embed>"+
		"</object>";
	return output;
}

function redirect( url ){
	var timeout_id = window.setTimeout(function(){ getURL(url); }, 5000);	
}

function getURL( url ){
	window.location.href = url;
}

function errorCheck(){
	var name = document.getElementById('name');
	var email = document.getElementById('email');
	
	var error = new Array();
	
	if( name.value == '' ) error.push('Name');
	if( email.value == '' ) error.push('Email');
	
	if( error.length > 0 ){
		var msg = 'The following fields are required to continue:' + "\n\n";
			msg += error.join(", ");
		
		alert(msg);
		
		return false;
	}
	
	return true;
}

function aField( obj ){
	var txt = document.getElementById('txt_' + obj.id);
	
	obj.className = 'field_on';
	if( txt ) txt.style.fontWeight = 'bold';
}

function dField( obj ){
	var txt = document.getElementById('txt_' + obj.id);
	
	obj.className = '';
	if( txt ) txt.style.fontWeight = 'normal';
}

function switchLink(name, imgs){
	var imgs = imgs.split(':');
	var tmp = '';
	
	if( name == 'multimedia' ){
		document.getElementById('multimediaLink').style.fontWeight = 'bold';
		document.getElementById('printLink').style.fontWeight = 'normal';
		
		for(var i = 0; i < imgs.length; i++){
			tmp += '<a href="#" onclick="switchContent(\''+imgs[i]+'\');">CD '+(i+1)+'</a>';
			
			if( i < imgs.length - 1 ) tmp += ' | ';
		}
		
		switchContent(imgs[0]);
	}else{
		document.getElementById('multimediaLink').style.fontWeight = 'normal';
		document.getElementById('printLink').style.fontWeight = 'bold';
		
		for(var i = 0; i < imgs.length; i++){
			tmp += '<a href="#" onclick="switchContent(\''+imgs[i]+'\');">IMG '+(i+1)+'</a>';
			
			if( i < imgs.length - 1 ) tmp += ' | ';
		}
		
		switchContent(imgs[0]);
	}
	
	document.getElementById('sub_row').style.display = '';
	document.getElementById('sub_links').innerHTML = tmp;
}

function switchContent(img){
	document.getElementById('img_src').src = '/clients/'+img;
}

function openTemplates(){
	var win = window.open('templates/index.php', 'Templates', 'menubar=0,location=0,titlebar=0,resizable=yes,scrollbars=yes,status=0,width=850,height=600');
}

function openWin(url, w, h)
{
	var win = window.open(url, 'OnlineMarketing', 'width='+w+',height='+h);
}
