function testBrowser() {
//method of detecting Flash is different for IE, NS and IE on Mac
	if (!readCookie6() ||!readCookie7() ) {
		setCookieJS();			
	}
	checkSize();
}

function entrypop() {
	for (i=1;i<5000;i++) {
		alert("You are not allowed here!");
	}
	exitpop();
}

function exitpop()
{
my_window= window.open ("reject.html",
  "mywindow1","status=1,width=600,height=400");
//my_window.document.write('<H1>Popup Test!</H1>'); 
}

//getFlashVersion();
flashVersion_DONTKNOW = -1;
gotFlash7 = false;
gotFlash6 = false;
flashVersion = flashVersion_DONTKNOW;
flashVersion=getFlashVersion();

function getFlashVersion() {
	//var latestFlashVersion = 7;
	var latestFlashVersion = 10; ///Current - latest version is 9
   var agent = navigator.userAgent.toLowerCase(); 
   
   // NS3 needs flashVersion to be a local variable
   if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
      flashVersion = 0;
   }
   
   // NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
   if (navigator.plugins != null && navigator.plugins.length > 0) {
      var flashPlugin = navigator.plugins['Shockwave Flash'];
      if (typeof flashPlugin == 'object') { 
         for (var i = latestFlashVersion; i >= 3; i--) {
            if (flashPlugin.description.indexOf(i + '.') != -1) {
               flashVersion = i;
               break;
            }
         }
      }
   }

   // IE4+ Win32:  attempt to create an ActiveX object using VBScript
   else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
      var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += 'On Error Resume Next \n';
      doc += 'Dim obFlash \n';
      doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = i \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }
      
   // WebTV 2.5 supports flash 3
   else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

   // older WebTV supports flash 2
   else if (agent.indexOf("webtv") != -1) flashVersion = 2;

   // Can't detect in all other cases
   else {
      flashVersion = flashVersion_DONTKNOW;
   }
   return flashVersion;

}

function writeInsert(){
	gotFlash7 = (flashVersion >= 7) ? true: false;
	gotFlash6 = (flashVersion==6) ? true: false;
	if (gotFlash6 || gotFlash7){
	document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="200" height="230">'); 
	document.write ('<param name="movie" value="flash/NobodyReads.swf">');
	document.write ('<param name="quality" value="high"> ');
	document.write ('<embed src="flash/NobodyReads.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  width="200" height="230"></embed>');
	document.write ('</object>');
	}
}
	
function writeFlash(){
	gotFlash7 = (flashVersion >= 7) ? true: false;
	gotFlash6 = (flashVersion==6) ? true: false;
	if (gotFlash6 || gotFlash7){
	document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="547" height="255">'); 
	document.write ('<param name="movie" value="flash/info_banner.swf">');
	document.write ('<param name="quality" value="high">');
	document.write ('<embed src="flash/info_banner.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="547" height="255"></embed>');
	document.write ('</object>');
	}
}

function writeNav(page){
	gotFlash7 = (flashVersion >= 7) ? true: false;
	if (gotFlash7){	
	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="150" height="640" id="flashnav" align="top"> ');
	document.write (' <param name="allowScriptAccess" value="always" /> ');
	document.write (' <param name="movie" value="flashnav.swf?loc=' + page + '" /> ');
	document.write (' <param name="quality" value="high" /> ');
	document.write (' <param name="bgcolor" value="#ffffff" /> ');
	document.write (' <embed src="flashnav.swf?loc=home.html" quality="high" bgcolor="#ffffff" width="150" height="640" name="flashnav" align="top" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed> ');
	document.write ('</object> '); 
	}
}

function setCookieJS() {
	gotFlash7 = (flashVersion >= 7) ? true: false;
	gotFlash6 = (flashVersion==6) ? true: false;	
	var curCookie = "setFlash7 =" + gotFlash7;
	document.cookie = curCookie;
	var curCookie = "setFlash6 =" + gotFlash6;	
	document.cookie = curCookie;
}

function readCookie7() {
	var name = "setFlash7";
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
 	if (begin == -1) {
		begin = dc.indexOf(prefix);
	if (begin != 0) return false;
	} else 
		begin += 2;
		var end = document.cookie.indexOf(";", begin); 
	if (end == -1)
  	end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
} 

function readCookie6() {
	var name = "setFlash6";
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
 	if (begin == -1) {
		begin = dc.indexOf(prefix);
	if (begin != 0) return false;
	} else 
		begin += 2;
		var end = document.cookie.indexOf(";", begin); 
	if (end == -1)
  	end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
} 

function checkSize() {	
	gotFlash7 = (flashVersion >= 7) ? true: false;
	gotFlash6 = (flashVersion==6) ? true: false;
	var sWidth =document.body.clientWidth;
	if (sWidth > 550) {
		sWidth = 550;
	}	
	
	pWidth = sWidth - 180;
	if (251 < sWidth < 380) {
		setFullSizeNarrow();	
		scaleDivsNarrow(sWidth-15);
	}
	if (sWidth < 250) {
		setPDAScreen();
	}
	if (sWidth > 380 && gotFlash7) {
		setFullSize();
		scaleDivs(pWidth, sWidth);
	}
	if (sWidth > 380 && gotFlash6 && !gotFlash7) {
		setFullSizeNoFlash7();
		scaleDivsNarrow(sWidth);
	}
	if (sWidth > 380 && !gotFlash6 && !gotFlash7) {
		setFullSizeNoFlash6();
		scaleDivsNarrow(sWidth);
	}	
}

function scaleDivs(pWidth, sWidth){
	//theDoc = document.getElementsByTagName("body");
	document.images['rule'].width = pWidth;
	elements = document.getElementsByTagName("div");
	for (i=0;i<elements.length;i++) {
		e=elements.item(i);
		if (e.className == 'columnFull') {
			e.style["width"] = pWidth;
		}
		if (e.className == 'columnLeft') {
			e.style["width"] = pWidth;
		}		
		if (e.className == 'navBar') {
			e.style["width"] = pWidth;
		}
		if (e.className == 'promotText') {
			e.style["width"] = pWidth;
		}
		if (e.className == 'fullPage') {
			e.style["width"] = sWidth;
		}
		if (e.className == 'columnRight') {
			if (sWidth < 493) {
				e.style["display"] = 'none';
			} else {
				e.style["display"] = 'block';
			}
		}
	}	
}

function scaleDivsNarrow(pWidth){
	//theDoc = document.getElementsByTagName("body");
	document.images['rule'].width = pWidth-2;	
	elements = document.getElementsByTagName("div");
	for (i=0;i<elements.length;i++) {
		e=elements.item(i);
		if (e.className == 'columnFull') {
			e.style["width"] = pWidth;
		}		
		if (e.className == 'columnLeft') {
			e.style["width"] = pWidth;
		}	
		if (e.className == 'navBar') {
			e.style["width"] = pWidth;
		}
		if (e.className == 'promotText') {
			e.style["width"] = pWidth;
		}
		if (e.className == 'fullPage') {
			e.style["width"] = pWidth;
		}
		if (e.className == 'columnRight') {
			if (pWidth < 315) {
				e.style["display"] = 'none';
			} else {
				e.style["display"] = 'block';
			}
		}		
	}
}

function setFullSize() {
//got Flash 7 and large window	
	document.getElementById('theme').href='info_action1.css';
}

function setFullSizeNoFlash7() {
//got Flash 6 and large window but not Flash 7
		document.getElementById('theme').href='info_action5.css';
}

function setFullSizeNoFlash6() {
//got large window but no Flash 6+
		document.getElementById('theme').href='info_action2.css';
}

function setFullSizeNarrow() {
//got narrow window
	document.getElementById('theme').href='info_action4.css';
}

function setPDAScreen() {
	screenWidth = 220;
	document.images['rule'].width = screenWidth;	
	document.getElementById('theme').href='info_action3.css';
	elements = document.getElementsByTagName("div");
	for (i=0;i<elements.length;i++) {
		e=elements.item(i);
		if (e.className == 'columnFull') {
			e.style["width"] = screenWidth;
		}
		if (e.className == 'columnLeft') {
			e.style["width"] = screenWidth;
		}
		if (e.className == 'navBar') {
			e.style["width"] = screenWidth;
		}
		if (e.className == 'promotText') {
			e.style["width"] = screenWidth;
		}	
		if (e.className == 'fullPage') {
			e.style["width"] = screenWidth;
		}			
	}
}

function sendpage(){
   document.frmcontact.action=getaddress();
   document.frmcontact.submit();
   document.frmcontact.reset();
   //alert(document.frmcontact.action)
   confirm_popup('confirm.html');
}

function getaddress() {
   add1 = "mailto:requests2";
   add2 = "info";
   add3 = "-action.com.au";
   address = add1 + "@" + add2 + add3;
   return address;
}

function confirm_popup(confirm) {newWindow=window.open(confirm,"newWindow","toolbar=no,location=(),alwaysRaised=yes,directory=no,status=0,scrollbars=yes,copyhistory=no,width=200,height=300");}

function insertBanner() {
	var doc = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="547" height="255">';
	doc += '<param name="movie" value="flash/info_banner.swf">';
	doc += '<param name="quality" value="high">';
	doc += '<embed src="flash/info_banner.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="547" height="255"></embed></object>';
	document.write(doc);
}


function writeContactPageREMOVE(){
	
	gotFlash7 = (flashVersion >= 7) ? true: false;
	if (gotFlash7){	
		strNav='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=';
		strNav+='"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="150" height="640" id="flashnav"';
		strNav+='align="top">';
		strNav+='<param name="allowScriptAccess" value="always" />';
		strNav+='<param name="movie" value="flashnav.swf?loc=" + "contact.html" />';
		strNav+='<param name="quality" value="high" />';
		strNav+='<param name="bgcolor" value="#ffffff" />';
		strNav+='<embed src="flashnav.swf?loc=home.html" quality="high" bgcolor="#ffffff" width="150" height="640" name="flashnav" align="top" ';
		strNav+='allowScriptAccess="always" type="application/x-shockwave-flash"';
		strNav+='pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>';
		strNav+='</object>'; 
	} else {
		strNav = "";
	}
	
	strForm='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n';
	strForm+="<html>\n";
	strForm+="<head>\n";
	strForm+="<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>\n";
	strForm+="<meta name = 'designer' content='Info Action www.info-action.com.au'>\n";
	strForm+="<title>Info Action: contact us</title>\n";
	strForm+='<script language="javascript" type="text/javascript" charset="ISO-8859-1" src="jspack.js"></script>\n';
	strForm+='<link rel="stylesheet" type="text/css" href="info_action3.css" ID = "theme">\n';
	strForm+="</head>\n";
	strForm+='<body onLoad="testBrowser()" onResize="checkSize()"> \n';
	strForm+='<div class="navBar"> <a class = "navText" href="home.html">Home </a><a class = "navText" href="contactscripted2.html">Contact </a>';
	strForm+='<a class = "navText" href="company.html">Company</a><a class = "navText" href="team.html"> Team </a>';
	strForm+='<a class = "navText" href="resources.html">Resources </a><a class = "navText" href="consulting.html">AuthorIT </a>';
	strForm+='<a class = "navText" href="tech-comm.html">Tech Writer </a><a class = "navText" href="manuals.html">Manuals </a>';
	strForm+='<a class = "navText" href="graphics.html">Graphics </a><a class = "navText" href="online.html">Online </a>';
	strForm+='<a class = "navText" href="flash.html">Flash </a><a class = "navText" href="threeDthings.html">3D&nbsp;things</a>';
	strForm+='<a class = "navText" href="awards.html">Awards</a>';
	strForm+="</div>\n";
	strForm+='<div class="columnNav">\n';
	
	//strForm+='<script language="JavaScript">\n';
	//strForm+='writeNav("contact.html")\n';
	//writeNav("contact.html");
	//strForm+='</script>\n';
	strForm+=strNav;
	
	strForm+='</div>\n';
	strForm+='<div class="columnFull">\n';
  	strForm+='<h1>Contact us... </h1>\n';
  	strForm+='<p class="bodyText">Use this form to request  information about our services, or submit suggestions';
	strForm+='on how we can improve the usability and relevance of our Web site!</p>\n';
  	strForm+='<blockquote>\n';
	strForm+='<p class="bodyText">Info Action Pty Ltd, ABN 79 083 648 453, Sydney.</p>\n';
    strForm+='<p class="bodyText">Postal: PO Box 6705, Baulkham Hills, NSW 2153, Australia.</p>\n';
  	strForm+='</blockquote>\n';
  	strForm+='<P class="bodyText">Please remember to include a contact name. We are happy to telephone you, provided that you';
	strForm+='include your number!</P>\n';
  	strForm+='<P class="announce">Note: please have a look at our business description before submitting your request! We do not provide support\n';
	strForm+='for Hotmail, Yahoo or any other type of email!</P>\n';
  	strForm+='<P class="bodyText">Your request:</P>\n';
	strForm+='<FORM action="sendmail.asp" method=post name="frmcontact">\n';
	strForm+='<TEXTAREA name="request" rows=8 cols=40></TEXTAREA>\n';
	strForm+='<INPUT type="button" value="Submit" name=InfoRequest onClick="this.form.submit()">\n';
	strForm+='<INPUT type=reset value="Clear">\n';
	strForm+='</FORM>\n';
 	strForm+='<p class="pinkRule"><IMG SRC="images/body-divider.gif" ID="rule"> </p>\n';
 	strForm+='<P class="smallText "><a href="http://www.info-action.com.au/home.html">Info Action (technical writing, illustrating, Flash)';
	strForm+='home</a></P>\n';
	strForm+='</div>\n';
	strForm+='</BODY>\n';
	strForm+='</HTML>\n';
	this.document.open();
	this.document.write(strForm);
	this.document.close();
}

function writeForm(){
	document.write ('<FORM action="sendmailC.asp" method=post name="frmcontact">');
	document.write ('<TEXTAREA name="request" rows=8 cols=40></TEXTAREA>');
	document.write ('<INPUT type="button" value="Submit" name=InfoRequest onClick="this.form.submit()">');
	document.write ('<INPUT type=reset value="Clear">');
	document.write ('</FORM>');
}

