// flow movies new window from baner
var okno; 
function nowe_okno(classid,name,tytul,opcje){ 
    if (okno){ 
        okno.close(); 
    } 
    okno = window.open('',tytul,opcje); 
    okno.document.open(); 

	okno.document.write("<HEAD><title>"+tytul+"</title></head><BODY leftmargin=1 topmargin=1 bgcolor=#EEEEEE><center><object classid="+classid+" codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 width=367 height=275 id="+name+" align=middle><param name=allowScriptAccess value=sameDomain><param name=movie value="+name+".swf><param name=quality value=high><param name=bgcolor value=#eeeeee /><embed src="+name+".swf quality=high bgcolor=#eeeeee width=367 height=275 name="+name+" align=middle allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer ></object></center></body>"); 
    okno.document.close(); 
    okno.focus(); 
} 

var okno2; 
function new_window2(title,name,otheroptions){ 
    if (window2){ 
        window2.close(); 
    } 
    window2 = window.open('',name,otheroptions); 
    window2.document.open(); 

	window2.document.write("<HEAD><title>"+title+"</title></head><BODY leftmargin=1 topmargin=1 bgcolor=#EEEEEE style={"+otheroptions+"}><center><img src="+name+"></object></center></body>"); 
    window2.document.close(); 
    window2.focus(); 
} 


function openSubcontent(navNum){
	document.getElementById('div'+navNum).style.display='';
	document.getElementById('more'+navNum).style.display='none';
}
function closeSubcontent(){

	for(i=0;i<5;i++){
		document.getElementById('more'+i).style.display='';
		document.getElementById('div'+i).style.display='none';
	}


}
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}

function subNavHilight(optionNum){
eval("document.getElementById('a'+optionNum).style").background='#def'
eval("document.getElementById('b'+optionNum).style").background='#def'
eval("document.getElementById('c'+optionNum).style").background='#def'
}
function subNavUnHilight(optionNum){
eval("document.getElementById('a'+optionNum).style").background='#fff'
eval("document.getElementById('b'+optionNum).style").background='#fff'
eval("document.getElementById('c'+optionNum).style").background='#fff'
subNavHilight(activeNum);
}
function selector(){
var location=document.webapp.selectbox.value
document.location=location
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function hideAll(){
eval("document.getElementById('op2MenuId').style").visibility="hidden"
eval("document.getElementById('hide2_1').style").visibility="hidden"
eval("document.getElementById('hide2_2').style").visibility="hidden"
eval("document.getElementById('hide2_3').style").visibility="hidden"
eval("document.getElementById('hide2_4').style").visibility="hidden"
}
function show(objId){
eval("document.getElementById('"+objId+"').style").visibility="visible"
eval("document.getElementById('hide2_1').style").visibility="visible"
eval("document.getElementById('hide2_2').style").visibility="visible"
eval("document.getElementById('hide2_3').style").visibility="visible"
eval("document.getElementById('hide2_4').style").visibility="visible"
}
function hilight(objId){
eval("document.getElementById('"+objId+"').style").background='#f27'
}

function unhilight(objId){
eval("document.getElementById('"+objId+"').style").background='#e00'
}

function calculate(form) {
var phpHostingCost=119.98
var hostingCost=74.98
var programmingRate=60
var designRate=45
var designCost=0
var programmingCost=0
var contentCost=0
var totalHours=0
var totalWeeks=0
var weekPlural=""
var basicFeatures=""
var advanceFeatures=""
var addedExtras=""
//var supportCost=0

var multiplier_cost=new Array()
multiplier_cost[0]=12 //homepage
multiplier_cost[1]=4 //about us
multiplier_cost[2]=4 //contact us
multiplier_cost[3]=4 //events and listings
multiplier_cost[4]=6 //membership form
multiplier_cost[5]=3 //recruitment
multiplier_cost[6]=6 //gallery
multiplier_cost[7]=3 //links
multiplier_cost[8]=8 //forum

var oneoff_cost=new Array()
oneoff_cost[0]=29 //e-commerce
oneoff_cost[1]=7 //customer,member database
oneoff_cost[2]=6 //send texts from website - logo
oneoff_cost[3]=2 //animated banner
oneoff_cost[4]=2 //music and sound
oneoff_cost[5]=4 //map
oneoff_cost[6]=2 //photography
//cost of support & maintenance
//		if(form.support[0].checked==true){supportCost=0}
//		if(form.support[1].checked==true){supportCost=100}
//		if(form.support[2].checked==true){supportCost=200}

//force selection in products select-box
		if((form.productsbox.value=="0")&&(form.products.checked==true)){
			form.productsbox.options[1].selected=true
		}
//cost of products and services
		if(form.products.checked==true){
			//designCost+=eval(form.productsbox.value)
			designCost+= eval(form.productsbox.value)
		}
//cost of content management
		if(form.content.checked==true){
			hostingCost=phpHostingCost
			for(var i=0;i<multiplier_cost.length;i++){
				if(eval("form.multiplier"+i).checked==true){
					contentCost+=1*programmingRate
				}
			}
		}
		if((form.products.checked==true)&&(form.content.checked==true)){
			contentCost+=eval(form.productsbox.value) * programmingRate
		}

//cost of everything else
	for(var i=0;i<multiplier_cost.length;i++){
		if(eval("form.multiplier"+i).checked==true){
			designCost+=multiplier_cost[i]
		}
	}

	for(var i=0;i<oneoff_cost.length;i++){
		if(eval("form.oneoff"+i).checked==true){
			if(eval("form.oneoff"+i).value=="design"){
				designCost+=oneoff_cost[i]
			}
			if(eval("form.oneoff"+i).value=="programming"){
				programmingCost+=oneoff_cost[i]
				hostingCost=phpHostingCost
			}
		}
	}
//Calculate the Hourage
totalHours=designCost+programmingCost;
if(totalHours<20){totalWeeks=1}
if((totalHours>19)&&(totalHours<40)){totalWeeks=2}
if((totalHours>39)&&(totalHours<60)){totalWeeks=3}
if(totalHours>59){totalWeeks=4}
if(totalWeeks>1){weekPlural="s"}
if(totalWeeks<1){weekPlural=""}
//Build strings for hidden fields
form.basicFeatures.value="";
form.advanceFeatures.value="";
form.addedExtras.value="";
if(form.multiplier0.checked){form.basicFeatures.value+="Home Page<BR />"}
if(form.multiplier1.checked){form.basicFeatures.value+="About Us<BR />"}
if(form.products.checked){form.basicFeatures.value+="Products/Services ("+(form.productsbox.value/2)+")<BR />"}
if(form.multiplier2.checked){form.basicFeatures.value+="Contact<BR />"}
if(form.multiplier3.checked){form.basicFeatures.value+="Events/Listings<BR />"}
if(form.multiplier4.checked){form.basicFeatures.value+="Membership Form<BR />"}
if(form.multiplier5.checked){form.basicFeatures.value+="Recruitment<BR />"}
if(form.multiplier6.checked){form.basicFeatures.value+="Gallery<BR />"}
if(form.multiplier7.checked){form.basicFeatures.value+="Links Page<BR />"}
if(form.multiplier8.checked){form.basicFeatures.value+="Forum<BR />"}
if(form.oneoff0.checked){form.advanceFeatures.value+="E-Commerce<BR />"}
if(form.oneoff1.checked){form.advanceFeatures.value+="Customer/Member Database<BR />"}
if(form.oneoff2.checked){form.advanceFeatures.value+="Send Texts From Website<BR />"}
if(form.content.checked){form.advanceFeatures.value+="Content Management<BR />"}
if(form.oneoff3.checked){form.addedExtras.value+="Animated Banner<BR />"}
if(form.oneoff4.checked){form.addedExtras.value+="Music/Sound<BR />"}
if(form.oneoff5.checked){form.addedExtras.value+="Game<BR />"}
if(form.oneoff6.checked){form.addedExtras.value+="Photography<BR />"}


//Final totaliser
designCost=(designCost*designRate)
programmingCost=(programmingCost*programmingRate)+contentCost
totalCost=designCost+programmingCost+hostingCost//+supportCost
form.designTotal.value="£"+designCost
form.programmingTotal.value="£"+programmingCost
form.hostingTotal.value="£"+hostingCost//+" <SPAN STYLE='COLOR:#F00'>FREE when you book online during November!</SPAN>"
form.total.value="£"+totalCost+"*"
form.totalWeeks.value=totalWeeks+" week"+weekPlural
//send vars to hidden fields
form.designCost.value=designCost
form.programmingCost.value=programmingCost
form.hostingCost.value=hostingCost
form.totalCost.value=totalCost
}

function flip(index){
	if(isOpen[index]){
		eval("block"+index).innerHTML=""
		isOpen[index]=false
	}
	else{
		eval("block"+index).innerHTML=content[index]
		isOpen[index]=true
	}
}