// JavaScript Document

//
var BASEURL = "/";
var mdpsobj = null;
function mdps_flash(type, d, px, py, state) {
	var swf;
	var width;
	var height;
	if( type == 'usa' ) {
		swf = "mdpsusa.swf";
		width = "620";
		height = "337";
	} else if( type == 'world' ) {
		swf = "mdpsworld.swf";
		width = "620";
		height = "361";
	} else if( type == 'map-usa' ) {
		swf = "mdmap-usa.swf";
		width = "623";
		height = "500";
	} else if( type == 'map-world' ) {
		swf = "mdmap-world.swf";
		width = "620";
		height = "361";
	
	} else {
		return;	
	}
	swf = BASEURL+"distributor/js/"+swf;
	var content = '';
	//content += '<div id="PMDP">';
	content += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="MDPSSWF" width="'+width+'" height="'+height+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">';
	content += '<param name="movie" value="'+swf+'" />';
	content += '<param name="quality" value="high" />';
	if( type == 'map-usa' && state ) {
		content += '<param name="Flashvars" value="state='+state+'" />';
	}
	content += '<param name="bgcolor" value="#FFFFFF" />';
	content += '<param name="wmode" value="transparent" />';
	content += '<param name="allowScriptAccess" value="sameDomain" />';
	content += '<embed src="'+swf+'" quality="high"';
	if( type == 'map-usa' && state ) {
		content += ' Flashvars="state='+state+'"';
	}
	content+= ' bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="MDPSSWF" align="middle" play="true" loop="false" quality="high" wmode="transparent" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed>';
	content += '</object>';
	//content += '<input type="hidden" name="position_x" id="uploadfilea">';
	//content += '<input type="hidden" name="uploadfileb" id="uploadfileb">';
	//content += '</div>';
	
	if( d && mdps_$(d) ) {
		mdps_$(d).innerHTML = content;
	} else {
		document.write(content);
	}
	mdps_init();
}
function mdps_init() {
	mdpsobj = mdps_get();
	if( mdpsobj ) {
		//
	}
}
function mdps_get() {
	if (navigator.appName.indexOf ("Microsoft") !=-1) {
		return window["MDPSWF"];
	} else {
		return document["MDPSWF"];
	}
}
//AS CALL JS
function mdps_position(px, py) {
	document.getElementById("position_x").value = px;
	document.getElementById("position_y").value = py;
}
function mdps_w2up() {
	document.location.href = 'http://www.meganracing.com/contact/distributor_usa.asp';
}
function msdp_state_goto(state) {
	document.location.href = 'http://www.meganracing.com/contact/distributor_usa.asp?state='+state;
}
function msdp_state_select(state) {
	document.getElementById("position_state").value = state;
}
function msds_dsk_goto(name) {
	document.location.href = 'http://www.meganracing.com/contact/distributor_world.asp?keyword='+name;
}
//
function mdps_$(eid, d) {
	if( mdps_isUndefined(d) ) {
		d = document;
	}
	if( d.getElementById ) {
		return d.getElementById(eid);
	} else if( d.all ) {
		return d.all[eid];
	} else if( d.layers ) {
		return d.layers[eid];
	} else {
		return null;
	}
}
function mdps_$N(name, obj) {
	if( typeof(obj) == "undefined" ) {
		obj = document;
	}
	if( obj.getElementsByTagName(name) ) {
		return obj.getElementsByTagName(name);
	} else {
		return null;
	}
}
function mdps_isUndefined(variable) {
	return typeof variable == 'undefined' ? true : false;
}
//

