		var cloc=document.location.href;
		var JS_SITE;
		var JS_SECTION;
		var JS_SUB_SECTION;
		var JS_AD_MEM_TAG;
		var index;
		var countbegin;
		var countend;
		var count; 
		
		if (isFirstItem(cloc)) 
		{	

           	document.write('<div id="otpovercover">');		
			document.write('<div id="otpbox">');
			document.write('<div id="slide_subheader" class="slide_subheader">');
			document.write('</div>');	
		}

		//enter otp ad details:
		var otpWidth = '100%';                                             //width of OTP swf
		var otpHeight = '100%';                                            //height of OTP swf
		var timerSeconds = 6;                                           //if required, enter # seconds otp will show 
		var hideFormDropdownsDuringOtp = false;                         //change to true if you want drop-down menus to hide when OTP plays

		//enter cookie details
		var cookie_days = 0; //if you need to manually set a cookie, enter number of days until cookie expires, otherwise leave this value as zero
		var cookie_name = "unique_cookie_name_2"; //if manually setting a cookie, enter a unique cookie name, must have a name here at all times
		var cookie_domain = ".ninemsn.com.au"; //leave this cookie domain as is

		//enter z-index for both OTP and Reminder
		var z_index = 10; //higher sits above more layers, lower will sit under some layers on the page

    	/* OTP AD */ 
		document.write('<div id="otpDiv" style="Z-INDEX:' +z_index+ ';position:absolute;left:0px;top:0px;margin-top:300px;text-align:center;visibility:hidden;width:'+otpWidth+';height:'+otpHeight+';"></div>');
		window.setTimeout("doCookie()",2000); 


		//should now prevent "operation aborted" error, by waiting till <BODY></BODY> has loaded...
		window.onload = function(){ launchOTP(); }



		if (isFirstItem(cloc)) 
		{
	    	//document.write('<div class="foot">');
		//	document.write('</div>');
			document.write('</div>');
			document.write('</div>');
			
		}

		
		function isFirstItem(inputURL)
		{
			if (inputURL.indexOf('photo=1')>0) 
			{
				return false;
			} 
			else 
			{
				if(inputURL.indexOf('photo=')<0) 
				{
					return true;
				}else{
					return false;
				}
			}
		}


		/************************************************************************************************************************/
		/** Below are all the supporting functions **/
		/************************************************************************************************************************/
		
		//These functions will hide form elements on the page while takeover is playing
		function hideFormElement(elmID){ for(i=0;i<document.all.tags(elmID).length;i++){ obj=document.all.tags(elmID)[i]; if(!obj||!obj.offsetParent) continue; obj.style.visibility="hidden"; }}
		function showFormElement(elmID){ for(i=0;i<document.all.tags(elmID).length;i++){ obj=document.all.tags(elmID)[i]; if(!obj||!obj.offsetParent) continue; obj.style.visibility=""; }}

		/************************************************************************************************************************/
		//cookie functions 
		function doCookie(){ if(document.cookie){ index=document.cookie.indexOf(cookie_name); }else{ index=-1; } var date=new Date(); date.setTime(date.getTime()+(cookie_days*24*60*60*1000)); var expires=date.toGMTString(); if(index==-1){ document.cookie=cookie_name+"=1; expires="+expires+"; domain="+cookie_domain; }else{ countbegin=(document.cookie.indexOf("=", index)+1); countend=document.cookie.indexOf(";", index); if(countend==-1){ countend=document.cookie.length; } count=eval(document.cookie.substring(countbegin, countend))+1; document.cookie=cookie_name+"="+count+"; expires="+expires+"; domain="+cookie_domain; }}
		function getTimes(){ if(document.cookie){ index=document.cookie.indexOf(cookie_name); if(index!=-1){ countbegin=(document.cookie.indexOf("=", index)+1); countend=document.cookie.indexOf(";", index); if(countend==-1){ countend=document.cookie.length; } count=document.cookie.substring(countbegin, countend); return (count); }} return 0; }

		/************************************************************************************************************************/
		//position otp outside parent divs to float on top
		var isIE=(navigator.userAgent&&navigator.userAgent.indexOf("MSIE")>=4)?true:false;
		function moveFloatLayer()
		{
			//if cant find otpDiv, call this function again	

			if(!document.getElementById('otpDiv'))
			{
				window.setTimeout("moveFloatLayer()", 1000); //if object not found, check again
			}
			else
			{ 	//if object found...
				var move_otp = document.getElementById('otpDiv');//First, get the ad div
 				if(isIE) move_otp.removeNode(true);              //Second, remove it from it's parent - IE ONLY
 				document.body.appendChild(move_otp);             //Third, append div to body element (at bottom of the page)
 				move_otp = null;                                 //Fourth, do a little clean up to avoid memory leaks.
				//document.getElementById('otpDiv').style.left = '25%';
				//document.getElementById('otpDiv').style.top = '40%';
				
				if(getTimes()<3){ /*check cookie*/ 
					if (isFirstItem(cloc)) {
						slideshowLayer(); //load flash objects to show ad
					} 
					else 
					{
						hideSlideShowLayer(); //load flash objects but hide otp ad, show reminder
					}
				}
				else
				{ 
					hideSlideShowLayer(); //load flash objects but hide otp ad, show reminder
				}
			}
		}

		/************************************************************************************************************************/
		function slideshowLayer()
		{
			sAd(); //load flash object - OTP
			if(timerSeconds>0)
			{
			    window.setTimeout("hideSlideShowLayer()",(timerSeconds*1000));
			}
			if(hideFormDropdownsDuringOtp)
			{
			    hideFormElement("SELECT");
			}
			document.getElementById('otpovercover').style.display='block';
			document.getElementById('otpDiv').style.visibility='visible';
		}

		/************************************************************************************************************************/
		//hide, show, and launch functions
		function hideSlideShowLayer()
		{ 
			document.getElementById('otpDiv').style.visibility='hidden';
			if (isFirstItem(cloc)) 
			{
				document.getElementById('otpovercover').style.visibility='hidden';
			}
		}
		function sAd() 
		{
			var jsVoteAd = '/SITE='+JS_SITE+'/AREA='+JS_SECTION+'/SUBSECTION='+JS_SUB_SECTION+'/LOC=TOP/AAMSZ=MEDIUM'+JS_AD_MEM_TAG;
			jsVoteAd = jsVoteAd + '/METHOD=IFRAME/FRAMESIZE=300X250';
			
			var oAd = spac_returnAd(jsVoteAd);
			var oa = document.getElementById("otpDiv");
			oa.innerHTML = oAd + '<div id="closead" style="width:300px;margin:auto;text-align:center;margin-top:20px"><div class="caption">Your photo slideshow will load shortly...</div> <hr> <a href="javascript:hideSlideShowLayer();">skip ad</a></div>' ;
		}

		/************************************************************************************************************************/
		function launchOTP()
		{ 
			window.setTimeout("moveFloatLayer()",1); 
		}







