var maxfont=16
var minfont=10
var currfont=12

var cookiename = "sharpefontsize"

function comingsoon()

{
	alert('PDF specification sheets coming soon.')	
}
function checkemail(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
//		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
//		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
//		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
//		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
//		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
//		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
//		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}


function sendform()

{
	var err=''
//	alert('This function is not available at present.')	


	if (document.all.name.value=='Name') err='1'
	if (document.all.telephone.value=='Telephone') err='1'
	if (document.all.email.value=='E-mail') err='1'

	if (err=='1') err='You need to fill in all details to send a call back request.'
		
	if (err=='')
	{		
		if (checkemail(document.all.email.value)==false) err+='The email address is not in the correct format.'
	}

	if (err!='') alert(err)
	
	if (err=='')
		{
			document.all.currentpage.value=window.location
			callback.submit()
		}
	
}
function fontcookie()

{
 var data=currfont.toString()
 
 if(document.cookie != document.cookie) 
	{
		index = document.cookie.indexOf(cookiename);
	}
 else 
	{ 
		index = -1;
	}


 if (index == -1)
  {
	 document.cookie=cookiename+"="+data+"; expires=Friday, 31-Dec-2010 05:00:00 GMT";  
  }
}

function getcookie()

{
	var cf=''
	var newcurrfont=0
	var st=document.cookie
	var n=st.indexOf("sharpefontsize")
	st=st.substring(n,st.length)
	
	if (st.charAt(0)=='s')
		{
			cf=getName()
			newcurrfont=parseInt(cf,10)
			changefontsize(newcurrfont-currfont)
		}
}



function getName() {
    if(document.cookie)
       {
        index = document.cookie.indexOf(cookiename);
        if (index != -1)
           {
            namestart = (document.cookie.indexOf("=", index) + 1);
            nameend = document.cookie.indexOf(";", index);
            if (nameend == -1) {nameend = document.cookie.length;}
            rdata = document.cookie.substring(namestart, nameend);
            return rdata;
           }
        }
      }

function tab(idx)

{
	if (idx==1) window.location='solutions.html'
	if (idx==2) window.location='services.html'	
	if (idx==3) window.location='supply.html'	
	if (idx==4) window.location='support.html'	
	
}
function sizechange()

{
	var y=document.body.clientHeight
	var x=document.body.clientWidth
	
	document.all.bottombanner.style.visibility='hidden'			
	document.all.bottombanner.style.top="0px"
			
	document.all.bottombanner.style.left="0px"

	document.all.bottombanner.style.visibility='visible'			


	if (document.body.scrollHeight>document.body.clientHeight) 
		{

			y=document.body.scrollHeight-88

			document.all.bottombanner.style.top=y.toString()+"px"
			document.all.bottombanner.style.visibility='visible'			
		}
		
	if (document.body.scrollHeight<=document.body.clientHeight) 
		{
			y=document.body.clientHeight-88
			document.all.bottombanner.style.top=y.toString()+"px"
			document.all.bottombanner.style.visibility='visible'			
		}
	

}

function scrollbar()
{
	
}

function changefontsize(idx)

{
	var n=0
	var s=0
	var prevcurrfont=currfont
	
	var p=document.getElementsByTagName('p');
	
	for (n=0;n<p.length;n++)
		{		
			s=prevcurrfont+idx
			if (s==minfont-1) s=minfont
			if (s==maxfont+1) s=maxfont			
			p[n].style.fontSize = s+"px"			
		}
	
	currfont=s
	
	fontcookie()
	sizechange()
}

function showmore(idx)

{

	document.all["textblock"+idx.toString()].innerHTML='<div align="left"><p align="justify" class=maintext'+currfont.toString()+'>'+moreinfo[idx]+'</p></div><div align="right"><p class=maintext'+currfont.toString()+'><a href="javascript:showless('+idx.toString()+')"><font color="#990000">Less</font></a></p></div>'
	sizechange()
}

function showless(idx)

{

	document.all["textblock"+idx.toString()].innerHTML='<div align="right"><p class=maintext'+currfont.toString()+'><a href="javascript:showmore('+idx.toString()+')"><font color="#009966">More</font></a></p></div>'
	sizechange()
}

function positionbanner()
{
	var x=document.body.clientWidth
	var y=0


//	document.all.banner.style.visibility='hidden'			
//	document.all.banner.style.top="0px"
			
//	document.all.bottombar.style.width=x.toString()+"px"
//	document.all.topbar.style.width=x.toString()+"px"

	
//	document.all.navigatetop.style.width=x.toString()+"px"
//	document.all.navigatetop.style.left="0px"	

//	document.all.banner.style.width=x.toString()+"px"
//	document.all.banner.style.left="0px"

/*
	if (document.body.scrollHeight>document.body.clientHeight) 
		{
			y=document.body.scrollHeight-88
			document.all.banner.style.top=y.toString()+"px"
			document.all.banner.style.visibility='visible'
		}
		
	if (document.body.scrollHeight<=document.body.clientHeight) 
		{
			y=document.body.clientHeight-88
			document.all.banner.style.top=y.toString()+"px"
			document.all.banner.style.visibility='visible'			
		}
*/
}

window.onscroll = function() { sizechange() }
window.onresize = function() { sizechange() }

