//Detect Flash version >= 6
var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;
function ControlVersion(){var version;var axo;var e;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version");}catch(e){} if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,21,0";}catch(e){}} if(!version){version=-1;} return version;}
function GetSwfVer(){var flashVer=-1;if(navigator.plugins!=null&&navigator.plugins.length>0&&navigator.plugins["Shockwave Flash"]){var flashDescription=navigator.plugins["Shockwave Flash"].description;var descArray=flashDescription.split(" ");var tempArrayMajor=descArray[2].split(".");var flashVer=tempArrayMajor[0]+".0.0";}else if(isIE&&isWin&&!isOpera){flashVer=ControlVersion();} return flashVer;}
function DetectFlashVer(reqMajorVer){versionStr=GetSwfVer();if(versionStr==-1){return false;}else if(versionStr!=0){if(isIE&&isWin&&!isOpera){tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",");}else{versionArray=versionStr.split(".");} var versionMajor=versionArray[0];if(versionMajor>=parseFloat(reqMajorVer)){return true;} return false;}}

//Used to load objects during page load
function generateExternalObject(html){document.write(html);}
//Used to load objects after page load
function getFlashObject(mov,w,h,id,targetDiv){
	targetDiv.innerHTML = getFlashObjectString(mov,w,h,id);
}
function getFlashObjectString(mov,w,h,id){
	if(!id){id="SmileyTour";}
	// set all the variables here
	var flashObj = new Object();
	flashObj.classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
	flashObj.codebase = "#version=6,0,0,0";
	flashObj.width = w;
	flashObj.height = h;
	flashObj.id = id;
	flashObj.align = "middle";
	//params
	flashObj.movie = mov;
	flashObj.play = "false";
	flashObj.menu = "false";
	flashObj.quality = "high";
	flashObj.wmode = "transparent";
	flashObj.bgcolor = "#ffffff";
	//embed
	flashObj.type = "application/x-shockwave-flash";
	flashObj.pluginspage = "http://www.macromedia.com/go/getflashplayer";

	// output the object and embed tags using the data entered above
	var flashTag = "<object classid=\"" + flashObj.classid + "\"" +
				   " width=\"" + flashObj.width + "\"" +
				   " height=\"" + flashObj.height + "\"" +
				   " id=\"" + flashObj.id + "\"" +
				   " align=\"" + flashObj.align + "\">\n" +
				   "<param name=\"movie\" value=\"" + flashObj.movie + "\">\n" +
				   "<param name=\"play\" value=\"" + flashObj.play + "\">\n" +
				   "<param name=\"menu\" value=\"" + flashObj.menu + "\">\n" +
				   "<param name=\"quality\" value=\"" + flashObj.quality + "\">\n" +
				   "<param name=\"wmode\" value=\"" + flashObj.wmode + "\">\n" +
				   "<param name=\"bgcolor\" value=\"" + flashObj.bgcolor + "\">\n" +
				   "<embed src=\"" + flashObj.movie + "\"" +
				   " play=\"" + flashObj.play + "\"" +
				   " menu=\"" + flashObj.menu + "\"" +
				   " quality=\"" + flashObj.quality + "\"" +
				   " wmode=\"" + flashObj.wmode + "\"" +
				   " bgcolor=\"" + flashObj.bgcolor + "\"" +
				   " width=\"" + flashObj.width + "\"" +
				   " height=\"" + flashObj.height + "\"" +
				   " name=\"" + flashObj.id + "\"" +
				   " align=\"" + flashObj.align + "\"" +
				   " type=\"" + flashObj.type + "\"" +
				   " pluginspage=\"" + flashObj.pluginspage + "\"/>\n" +
				   "</object>\n";
	   return flashTag;
}//end function
//Used to generate html for talking smileys (with transport support) and interactive smileys
function copyToClipBoard(txt){window.clipboardData.setData("Text",txt);}
function toggleCopyHtml(id,state){
	btn=document.getElementById(id);
	if(state){
		btn.value="Copy HTML";
		btn.disabled=false;
	}else{
		btn.value="Copied";
		btn.disabled=true;
		setTimeout("toggleCopyHtml(\""+id+"\",1)",2000);
	}
}
function buildSmileyHtml(src,w,h,id,type,copy,cmode,auto,curl){
	var swf = "";
	var isInt = false;
	if (src.indexOf("FI") == 0) isInt = true;
	if (w == null) w = 100;
	if (h == null) h = 100;
	if (id == null) id = "";
	if (type == null) type = 0;
	if (copy == null || bFF == true) copy = 0;
	if (cmode == null) cmode = 1;
	if (curl == null){ curlparam = "";}else{ curlparam = "&curl="+escape(curl);}
	if (auto == null) auto = 0;
	if (isInt){
		try {
			swf = src.match(/FI\/\d\/(\d*)/i)[1];
		} catch (E) { return ""; }
	} else {
		try {
			swf = src.match(/(F\d*\/\d\/\d*)/i)[1];
		} catch (E) { return ""; }
	}//end if
	
	var embedUrl = "";
	var imgUrl = "";
	var dlUrl = "http://www.smileycentral.com/?feat=prof&partner=ZSzeb110_"+parentPtnrVal;
	
	var embedName = "transport"+id;
	var embedWidth = w;
	var embedHeight = h;
	if (isInt){
		embedUrl = escape(escape("http://smileys.smileycentral.com/cat/"+src+".swf"));
		imgUrl = escape(escape("http://ak.imgfarm.com/images/nocache/tr/fw/smiley/social2.gif"));
		embedName = "SmileyCentral"+id;
	} else {
		embedUrl = escape(escape("http://smileys.smileycentral.com/cat/F/transport.swf?code="+src+"&partner=ZSzeb110_"+parentPtnrVal+"&cmode="+cmode+"&auto="+auto+curlparam));
		imgUrl = escape(escape("http://ak.imgfarm.com/images/nocache/tr/fw/smiley/social2.gif"));
	}//end if

	embedUrl = embedUrl.replace(/[/]/g,"%252F");
	embedUrl = embedUrl.replace(/[_]/g,"%255F");
	
	imgUrl = imgUrl.replace(/[/]/g,"%252F");
	imgUrl = imgUrl.replace(/[_]/g,"%255F");
	
	if (isInt){
		embedUrl = "http://plugin.smileycentral.com/"+embedUrl+"/"+swf+".swf";
	} else {
		embedUrl = "http://plugin.smileycentral.com/"+embedUrl+"/transport.swf";
	}//end if
	
	var html = '';
	html = '<embed src="'+embedUrl+'"' +
			   ' loop="false"' +
			   ' quality="high"' +
			   ' bgcolor="#ffffff"' +
			   ' width="'+embedWidth+'"' +
			   ' height="'+embedHeight+'"' +
			   ' name="'+embedName+'"' +
			   ' align="middle"' +
			   ' allowScriptAccess="sameDomain"' +
			   ' type="application/x-shockwave-flash"' +
			   ' pluginspage="http://www.macromedia.com/go/getflashplayer"' +
			   ' wmode="transparent"';
	if (isInt){
		html += ' flashvars="code='+swf+'&partner=ZSzeb110_'+parentPtnrVal+'" />';
	} else {
		html += ' flashvars="code='+swf+'&partner=ZSzeb110_'+parentPtnrVal+'&cmode='+cmode+'&auto='+auto+curlparam+'" />';
	}//end if
	
	if (type == 0) {
		html = '<div>' + html + '<br><a href="'+dlUrl+'">' +
			   '<img src="http://plugin.smileycentral.com/'+imgUrl+'/social2.gif" border="0" style="" />' +
			   '</a></div>';
	} else {
		html = '<div>' + html;
		if (copy == 1) html += '<br><br style="font-size:3px;"><span style="font-size:9px;color:#a2a2a2;font-family:verdana,sans-serif;">Add this smiley to any web page!</span><br><br style="font-size:3px;"><input type="button" id="copy'+id+'" value="Copy HTML" onclick="copyToClipBoard(buildSmileyHtml(sSmileyCode,null,null,null,null,null,null,null,\''+curl+'\'));toggleCopyHtml(\'copy'+id+'\',0);" style="font-family:verdana;font-size:10px;color:#000;width:75px;height:20px;cursor:pointer;cursor:hand;">';
		html += '</div>';
	}//end if
	
	if (type == 0) {
		return html;
	} else {
		document.write(html);
	}//end if
}//end function