﻿
var rows;
var cols;
var pads;
var countx;

/*draw rows and columns of thumbsnails, paddings width apart. the numthumbs value
	allows you to have odd numbers of thumbnails without showing a blank image icon where the 
	nth even thumb would be.*/

function drawthumbs(rowy, colx, paddings, numthumbs){
	rows = rowy;
	cols = colx;
	countx = 1;
	pads = paddings;
	
	document.write("<table cellspacing = '0' cellpadding = '0' border = '0'>");
		for(i=0;i<rows;i++){
			document.write("<tr>");
			for(j=0;j<cols;j++){
				if(countx<=numthumbs){
				if(countx % 2 ==0){
					document.write("<td style = 'padding-right:0px; padding-bottom:"+pads+"px'>");
				}
				else{
					
					document.write("<td style = 'padding-right:"+pads+"px;padding-left:"+pads+"px; padding-bottom:"+pads+"px'>");
				}
				
				document.write("<img class = 'thumbs' onclick = \"mainpic.src = 'photos/"+countx+".jpg'; copyright.src = '../../graphics/copyrightanim.gif'\" onmouseover = \"this.style.borderColor= '#ffcc00'\" onmouseout = \"this.style.borderColor= '#999999'\"  src = 'photos/thumbs/"+countx+".jpg' name = 'pic"+countx+"' id = 'pic"+countx+"' >");
				document.write("</td>");
				}
				else{
				document.write("<td></td>");
				}
				countx++;
			}
			document.write("</tr>");
		}
		document.write("</table>");
		
	
}
function setme(pic){

document.images.mainpic.src = 'photos/'+pic+'.jpg';
}

/*draws the three tabs as placed on each of the galleries.
	with rollover effcts etc.*/
function drawtabs(){
	


}
	
	

var numrows = 4; //the number of table rows
var numcols = 7; //the number of tablecolumns
var countr = 0; //a count used to name images in the loop
	
function drawCoolOverlay(){
	var shadr = 1;
	document.write("<table class = 'backtable' cellspacing = '0' >");
	for(r=0;r<numrows;r++){
		document.write("<tr>");
		for(c=0;c<numcols;c++){
			//set the shader color in this line.
			document.write("<td>");
			document.write("<img onload='fixPNG(this)' onmouseover = \"this.src = 'graphics/shades/shadeoff.png'\" onmouseout = \"this.src = 'graphics/shades/red"+shadr+".png'\" name = pic"+countr+" class = 'shady' src = 'graphics/shades/red"+shadr+".png'></td>");
		}
		document.write("</tr>");
		countr++;
		if(shadr<3){shadr++;}
	
	}
	document.write("</table>");

}

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])


function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}


/*switches between the two images.*/
var sw = 0;
function switchMe(){
	if(sw==0){
		picx.src = "photos/home12.jpg"
		sw = 1;
	}
	else{
	picx.src = "photos/home11.jpg"
		sw = 0;
	}
	
	



}


/*
	check that the user has at least entereed the required fields
	nickname and country.
*/
function validateDetails(thisform){
	with (thisform){
		if (validateField(name,"please enter at least your name and phone number.")==false){
  			name.focus();
  			return false;
  		}
  		if (validateField(tel,"please enter at least your name and phone number.")==false){
		  	tel.focus();
		  	return false;
  		}
  		if(!isNumeric(tel.value,"please enter a valid phone number")){
      		tel.focus();
			return false;
		}	
  		else{
  		return true;}
	}
}

/*
	helper function called by the above two to check for blank or null entries.
*/
function validateField(field,alerttxt){
	with (field){
		if (value==null||value==""){
			alert(alerttxt);
			return false
		}
		else {
			return true
		}
	}
}

/*
	check that the value entered in the box is.... numeric.
*/
function isNumeric(numtext, alertxt)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

   for (i = 0; i < numtext.length && IsNumber == true; i++) { 
      Char = numtext.charAt(i); 
      if (ValidChars.indexOf(Char) == -1){
        	alert(alertxt);
			return false;
      }
   }
   return true; 
 }
											
											
											
function checkFlash(altclass){	

if((navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Mac") == -1 && navigator.appVersion.indexOf("3.1") == -1) || (navigator.plugins && navigator.plugins["Shockwave Flash"]) || navigator.plugins["Shockwave Flash 2.0"]){
document.write("<div class = 'homeflashpics' id='flashcontent'></div>");
   var fo = new FlashObject("graphics/homemovie.swf", "homemovie", "320", "260", "0", "#ffffff"); 
		fo.write("flashcontent");
   
}
else {
alert('ook');
    //Load a pre-defined HTML page without Flash Player into the browser window.
    document.write("<img id = '"+altclass+"' src = 'graphics/altpic.jpg'>");
}

}



/*this should simply set the new div as defined by num to visible, and set 
  the previous div, curr to hidden, then assin num to curr. 
  note that we first check that the new div is not the current div..*/




var curr = 1;
function showtext(num){

var myDom;
if (document.getElementsByTagName("*")) {
myDom = 'document.getElementsByTagName("*")'
}
else {
myDom = 'document.all'
}
	if(num!=curr){
		switch (num){
			case 1: document.getElementById('portraitxt').style.visibility = 'visible'; break;	
			case 2: document.getElementById('partiestxt').style.visibility = 'visible'; break;	
			case 3: document.getElementById('portfoliotxt').style.visibility = 'visible'; break;	
			
		}
		switch (curr){
			case 1: document.getElementById('portraitxt').style.visibility = 'hidden'; break;	
			case 2: document.getElementById('partiestxt').style.visibility = 'hidden'; break;	
			case 3: document.getElementById('portfoliotxt').style.visibility = 'hidden'; break;	
		}
		curr = num;
	}
}




















