/**
 * @package PRC Main JS file
 * @copyright (c) 2010 Forrent.com (Dominion Enterprises), All Rights Reserved
 * @author Kevin Strange <strange@forrent.com>
 * @author Allen Torres <allen.torres@forrent.com>
 * @since 04.12.2010
 * @version 2.0
 */

// Event logging
function logEvent(statType,site,event,searchID,logData,rootPath){
	try {	
	var url = 'http://' + location.host +"/ajax/eventLogging.ajax.php?site="+site+"&statType="+statType+"&logData="+logData+"&searchID="+searchID+"&event="+event;
	//alert(url);
	//var ajax = new Ajax.Updater("results", url,{evalScripts:true});
	$.post(url, {postId:site}, function () { /*nothing to do here*/ });
	} catch (e) { /*alert(e);*/ }
}

//  Flash check
var MM_contentVersion = 7;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i) {
		if (isNaN(parseInt(words[i])))
			continue;
		var MM_PluginVersion = words[i]; 
	}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
	FlashMode = 0;
	if (navigator.plugins && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash"]) {
			var plugin_version = 0;
			var words = navigator.plugins["Shockwave Flash"].description.split(" ");
			for (var i = 0; i < words.length; ++i) {
				if (isNaN(parseInt(words[i])))
					continue;
				plugin_version = words[i];
			}
			if (plugin_version >= 8) {
				var plugin = navigator.plugins["Shockwave Flash"];
				var numTypes = plugin.length;
				for (j = 0; j < numTypes; j++) {
					mimetype = plugin[j];
					if (mimetype) {
						if (mimetype.enabledPlugin && (mimetype.suffixes.indexOf("swf") != -1)) // Mac wierdness
							FlashMode = 1;
						if (navigator.mimeTypes["application/x-shockwave-flash"] == null)
							FlashMode = 0;
					}
				}
			}
		}
	}
	if (FlashMode == 1)
		var MM_FlashCanPlay = true;
	else
		var MM_FlashCanPlay = false;

}else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

function openWin( windowURL, windowName, windowFeatures ) {
	return window.open( windowURL, windowName, windowFeatures ) ;
}

// Real Media
OAS_url = 'http://ads.traderonline.com/RealMedia/ads/';
OAS_sitepage = "www.pararentar.com/";
OAS_listpos = 'Top';
OAS_query = '';
OAS_target = '_top';
// End configuration

OAS_version = 10;
OAS_rn =  new String (Math.random());
OAS_rns = OAS_rn.substring (2, 11);
function OAS_NORMAL(pos) {
	document.write('<a href="' + OAS_url + 'click_nx.cgi/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + '?' + OAS_query + '" target="' + OAS_target + '">');
	documnet.write('<img src="' + OAS_url + 'click_nx.cgi/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + '?' + OAS_query + '" border="0"></a>');
}

OAS_version = 11;
if (( navigator.userAgent.indexOf('Mozilla/3') != -1) || (navigator.userAgent.indexOf('Mozilla/4.0 WebTV') != -1))
	OAS_version = 10;
if (OAS_version >= 11)
	document.write('<scr' + 'ipt language="javascript1.1" src="' + OAS_url + 'adstream_mjx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '?' + OAS_query + '"><\/script>');

document.write('');
function OAS_AD(pos) {
	if (OAS_version <= 11)
		OAS_RICH(pos);
	else
		OAS_NORMAL(pos);
}

// Flash media center for the detail page
function mediaCenter() {
	var which_swf = 'http://' + serverArea + '/mediacenter2/media-center.swf';
	var flashParams = '?domain=' + serverArea + '&siteID=' + intSiteID + '&designName=' + designName;
	document.write ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="630" height="348" id="media-center" align="middle">');
	document.write ('<param name="allowScriptAccess" value="sameDomain" />');
	document.write ('<param name="movie" value="' + which_swf + flashParams +'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />');
	document.write ('<embed src="' + which_swf + flashParams +'" quality="high" bgcolor="#ffffff" width="630" height="348" name="media-center" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write ('</object>');
}

// Flash Browse Map
function browsemap() {
	var img_path = 'http://' + flashPath + '/flash/';
	var which_swf = 'us_map-pr-02.swf?&main=e51937&select=e5a306&bg=ffffff&letters=ffffff&bordercolor=ffffff&stroke=ffffff';
	var flashParams = '?&url1=' + flashPath + '/browse/&url2';
	document.write('<object type="application/x-shockwave-flash" data="' + img_path + which_swf + flashParams + '"  width="500" height="400"> ');
	document.write(' <param name="movie" value="' + img_path + which_swf + flashParams + '" /><param name="menu" VALUE="false" /><param name="allowscriptaccess" value="always"><param name="wmode" value="transparent" /> ');
	document.write('<\/object> ');
}
