
var flag = 0;
var oLayer;
var lay_w;
var lay_h;

document.write(swfTag("main",800,200,1,"true"));

function rmLayer(){if(flag){document.getElementsByTagName("body")[0].removeChild(oLayer);}};
if(navigator.appName.indexOf("Microsoft")!=-1){window.attachEvent('onunload', rmLayer);}

function swfTag(nm,w,h,z,t){
	var tag = "<div id='mainswf'>";
	var swf_file = 'http://www.3dtext.in/view.swf?id=CAeH3pyIhli&width=' + w + '&height=' + h + '&scale=' + z + '&transparent=' + t ;
	if(nm=="overlay"){swf_file+="&floating=true";}
	tag += '<object id=' + nm + ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + w + '" height="' + h + '" align="middle">';
	tag += '<param name="allowScriptAccess" value="always" />';
	tag += '<param name="movie" value="' + swf_file + '" />';
	tag += '<param name="quality" value="autolow" />';
	if((nm=="overlay")||(t=="true")){tag += '<param name="wmode" value="transparent" />';};
	tag += '<param name="salign" value="lt" />';
	tag += '<param name="SWLIVECONNECT" value="TRUE" />';
	tag += '<embed name=' + nm + ' SWLIVECONNECT="TRUE" salign="lt" align="middle" src="' + swf_file + '" quality="high" wmode="transparent" width="' + w + '" height="' + h + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	tag += '</object></div>';
	return tag;
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	}else{
		return document[movieName];
	}
}

function FloatingEnd(){
	oLayer.style.display='none';
	if(navigator.userAgent.indexOf("Chrome")==-1){
		oLayer.innerHTML='';
		rmLayer();
	}
	flag=0;
	document.getElementById("mainswf").style.display='block';
	thisMovie("main").externalstart();

}
function Floating(sc){
	thisMovie("main").externalstop();
	if(flag == 1){
		oLayer.innerHTML = swfTag("overlay",lay_w,lay_h,sc,"true");
		oLayer.style.display = "block";

		return;
	} else {
		document.getElementById("mainswf").style.display='none';

		oLayer = document.createElement('div');
		oLayer.setAttribute('id',"FloatText");
		oLayer.style.position = "absolute";
		oLayer.style.zIndex = 1000;
		oLayer.style.display = "block";
		flag = 1;
	}

	set_sc();set_sz(sc);
	var body = document.getElementsByTagName("body")[0].appendChild(oLayer);
	if(((navigator.userAgent.toUpperCase().indexOf("MAC OS X")>=0)||(navigator.userAgent.toUpperCase().indexOf("MAC")>=0))&&(navigator.appName.toUpperCase().indexOf("MICROSOFT")>=0)){window.scrollBy(0,1);}
	window.onscroll = set_sc;
}
function set_sc(){
	var arrayPageScroll = getPageScroll();
	oLayer.style.top = arrayPageScroll[1]+'px';
	oLayer.style.left = '0px';
}
function set_sz(sc){
	var arrayPageSize = getPageSize();
	var dx=0;
	if(navigator.appName.indexOf("Microsoft") == -1){
		if(arrayPageSize[1] > arrayPageSize[3]){dx=-16;}else{dx=0;}
	}
	lay_w=arrayPageSize[2]+dx;lay_h=arrayPageSize[3];
	oLayer.style.width = arrayPageSize[2]+dx+'px';
	oLayer.style.height = arrayPageSize[3]+'px';
	setTimeout(function(){oLayer.innerHTML = swfTag("overlay",lay_w,lay_h,sc,"true");},1);

}
function getPageScroll(){
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function handle(delta) {thisMovie((flag)?"overlay":"main").externalwheel(delta);}
function wheel(event){
var delta = 0;
if (!event) /* For IE. */
event = window.event;
if (event.wheelDelta) { /* IE/Opera. */
delta = event.wheelDelta/120;
if (window.opera)
delta=-delta;
} else if (event.detail) { /** Mozilla case. */
delta=-event.detail/3;
}
if(delta)handle(delta);
if(event.preventDefault) {
event.preventDefault();
}
event.returnValue = false;
}

if(window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;
