function openNonScrollingWindow(URL)
{
	newWindow=window.open(URL,"","height=700,width=550,left="+(screen.width - 550)/2+",top="+(screen.height - 700)/2+",fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
}

function GetXmlHttpObject() {
    var xmlHttp = null;
    try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {
        // Internet Explorer
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp;
}

function showThat(page, where, font) {
    myRand = parseInt(Math.random() * 999999); // cache buster
    theurl = page + ".asp?rand=" + myRand + "&font=" + font;
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) { alert("Your browser does not support AJAX!"); return; }
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) document.getElementById(where).innerHTML = xmlHttp.responseText;
    }
    xmlHttp.open("GET", theurl, true);
    xmlHttp.send(null);
}

function changeTabs(a)
{
	document.getElementById("menu"+a).className="active";
	for(i=1;i<9;i++) { if (i!=a) document.getElementById("menu"+i).className=""; }
}

function showInfo(what,a){
	
	info=document.getElementById(what);
	pm=document.getElementById("plusminus"+a);
	if (info.style.display=="none")
	{
		info.style.display="block";
		pm.src="../../images/minus.png";
	}
	else if (info.style.display=="block")
	{
		info.style.display="none";
		pm.src="../../images/plus.png";
	}
}

function makeActive(a)
{
	thebutton=document.getElementById(a);
	thebutton.src="../../images/"+a+"Active.png";
}

function makeInactive(a)
{
	thebutton=document.getElementById(a);
	thebutton.src="../../images/"+a+".png";
}

function gotoThat(a,b,c)
{	
	if ((b-1)<Math.abs(c-1)) location.assign(a+"="+Math.abs(b-1));
	else location.assign(a+"="+Math.abs(c-1));
	if (b<=0) location.assign(a+"=0");
}

function checkTshirtForm(a,b)
{	
    var name=document.getElementById("thename");
    var address=document.getElementById("theaddress");
    var PO=document.getElementById("thePO");
    var city=document.getElementById("thecity");
    var mail=document.getElementById("themail");
    var phone=document.getElementById("thephone");
    var submitbutton=document.getElementById("thesubmitbutton");
    
	switch(a){
	    case 1:
	        if (b.indexOf(" ")==-1) { alert("Please enter both your name and surname."); break; }
	        else { address.style.display='block'; address.focus(); break; }
	    case 2:
	        if (b.indexOf(" ")==-1) { alert("Please enter the road number as well."); break; }
	        else { PO.style.display='block'; PO.focus(); break; }
	    case 3:
	        if (checkIfNumber(b)==false) { alert("Please enter a valid postal code."); break; }
	        else { city.style.display='block'; city.focus(); break; }
	    case 4:
	        mail.style.display='block';
	        mail.focus();
	        break;
	    case 5:
	        if ((b.indexOf("@")==-1)||(b.indexOf(".")==-1)) { alert("Please enter a valid e-mail adress."); break; }
	        else { phone.style.display='block'; phone.focus(); break; }
	    case 6:
	        if (checkIfNumber(b)==false) { alert("Please enter a valid telephone number (don't enter spaces between the numbers)."); break; }
	        else { submitbutton.style.display='block'; break; }
	    case 7:
	        thestring="You have entered the following information:\n\n"+name.value+"\n"+address.value+", "+PO.value+", "+city.value+"\n"+mail.value+"\n"+phone.value+"\n\nAre you sure the information you entered are correct?";	        
	        var confirmation=window.confirm(thestring);
	        if (confirmation)
	            { var theform=document.getElementById("tshirtForm"); theform.submit(); break; }
            else
	            break;
	}	
}

function checkIfNumber(a)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < a.length && IsNumber == true; i++) 
      { 
          Char = a.charAt(i); 
          if (ValidChars.indexOf(Char) == -1) 
             {
                IsNumber = false;
             }
      }
   
   return IsNumber;
}

var currentFS=0;
var currentLH=0;

function changeTextSize(a)
{
    valuesFS=new Array(10,11,12,14,16);
    valuesLH=new Array(15,15,16,18,20);
    
    thetext=document.getElementById("alltext");    
    
    if (a=="down")
    {
        if (currentFS>0)
        {
            currentFS=currentFS-1;
            thetext.style.fontSize=valuesFS[currentFS]+"px";
            currentLH=currentLH-1;
            thetext.style.lineHeight=valuesLH[currentLH]+"px";
        }
        else;
    }
    else if (a=="up")
    {
        if (currentFS<4)
        {            
            currentFS+=1;
            thetext.style.fontSize=valuesFS[currentFS]+"px";
            currentLH+=1;
            thetext.style.lineHeight=valuesLH[currentLH]+"px";
        }
        else;
    }
}