var sendhere="adgame@jjcreative.com";

//General image pre-loads
gen=new Array()
gen[0]="../gameimages/jjhead.gif";
gen[1]="../gameimages/fin.gif";
gen[2]="../gameimages/redo.gif";
gen[3]="../gameimages/border4.gif";
gen[4]="../gameimages/border2.gif";
gen[5]="../gameimages/border3.gif";
gen[6]="../gameimages/border1.gif";
gen[7]="../gameimages/minispacer.gif";
gen[8]="../gameimages/taxi.gif";
gen[9]="../gameimages/re.gif";
gen[10]="../gameimages/resel.gif";
gen[11]="../gameimages/send.gif";
gen[12]="../gameimages/caller.gif";
gen[13]="../gameimages/swoosh.gif";
gen[14]="../gameimages/cover1.gif";
gen[15]="../gameimages/cover2.gif";
gen[16]="../gameimages/cover3.gif";
gen[17]="../gameimages/cover4.gif";
gen[18]="../gameimages/under.gif";
pre1=new Array()
for(i=0; i < gen.length; i++){
 pre1[i]=new Image();
 pre1[i].src=gen[i];
}


//Selection image pre-loads
pre2=new Array()
images=new Array(
"../gameimages/p1.gif",
"../gameimages/p2.gif",
"../gameimages/p3.gif",
"../gameimages/p4.gif",
"../gameimages/p5.gif",
"../gameimages/p6.gif",
"../gameimages/p7.gif",
"../gameimages/p8.gif",
"../gameimages/p9.gif"
)
for(i=0; i < images.length; i++){
 pre2[i]=new Image();
 pre2[i].src=images[i];
}

//Link image pre-loads
var isload = false;
image1=new Image();
image1.src="../images/about_off.gif";
image1on=new Image();
image1on.src="../images/about_on.gif";
	
image2=new Image();
image2.src="../images/team_off.gif";
image2on=new Image();
image2on.src="../images/team_on.gif";
	
image3=new Image();
image3.src="../images/portfolio_off.gif";
image3on=new Image();
image3on.src="../images/portfolio_on.gif";

image4= new Image();
image4.src="../images/ado_off.gif";
image4on=new Image();
image4on.src="../images/ado_on.gif";

image5=new Image();
image5.src="../images/contact_off.gif";
image5on=new Image();
image5on.src="../images/contact_on.gif";

var ns=(document.layers);
var ns6=(document.getElementById&&!document.all);
var ie=(document.all);
var mac=(navigator.appVersion.indexOf('Mac')>0);


var d=(ns||ie)?'document.':'document.getElementById("';
var a=(ns||ns6)?'':'all.';
var r=(ns6)?'")':'';
var s=(ns)?'':'.style';





//Initial positions
y1=120;
y2=215;
y3=310;

x1=164;
x2=259;
x3=354;

//Snap to positions
ys1=117;
ys2=212;
ys3=307;

xs1=546;
xs2=546;
xs3=546;

T=new Array(y1,y2,y3,y1,y2,y3,y1,y2,y3)
L=new Array(x1,x1,x1,x2,x2,x2,x3,x3,x3)

function popper(msg) {
  stup =  "popup.htm?" + msg;
   var newwin = window.open(stup,"popwin", "width=255,height=225,scrollbars=no,menubar=no,directories=no,location=no,screenX=200,left=200,screenY=200,top=200,toolbar=no");
}

function on1(name){
if (ns)document.navbar.document[name].src = eval(name + "on.src");
if (ie)document[name].src = eval(name + "on.src");
if (ns6)document.images[name].src = eval(name + "on.src");
}
function off1(name){
if (ns)document.navbar.document[name].src = eval(name + ".src");
if (ie)document[name].src = eval(name + ".src");
if (ns6)document.images[name].src= eval(name + ".src");
}
isload = true;
function on(name){
if (isload) on1(name);
}
function off(name){
if (isload) off1(name);
}

var y=null;
var x=null;
var z=null;
var W=null;
var mouseY=0;
var mouseX=0;
var Top=null;
var Mid=null;
var Bot=null;
var Head=null;
var Body=null;
var Legs=null;

//Messages for each drag image.
msg=new Array()
msg[0]="<font color='#333333'><b>Speedy Alka-Seltzer:</b>&nbsp;Created in 1951, the Speedy Alka-Seltzer character didn't fizz out until 1964.</font>";
msg[1]="<font color='#333333'><b>Charlie the Tuna:</b>&nbsp;To this day, StarKist Tuna's official spokes-fish continues to miss the boat. Sorry Charlie.</font>";
msg[2]="<font color='#333333'><b>The Jolly Green Giant:</b>&nbsp;Since he Ho, Ho, Ho'd his way onto the scene in 1950, this leaf-wearing vegetarian has become an industry giant.</font>";
msg[3]="<font color='#333333'><b>Aunt Jemima:</b>&nbsp;Everyone's favorite Aunt has been pouring it on since 1893.</font>";
msg[4]="<font color='#333333'><b>Clanky Chocolate Flavored Syrup:</b>&nbsp;Created in 1963, this tall, dark, handsome robot doubled as a squeeze dispenser.</font>";
msg[5]="<font color='#333333'><b>Bob's Big Boy:</b>&nbsp;Bob's smile is as big as ever, although he's got far fewer locations than he used to.</font>";
msg[6]="<font color='#333333'><b>Captain Crunch:</b>&nbsp;Cap'n Horatio Crunch has been sailing the milky seas with his first mate &quot;Sea Dog&quot; for over 30 years.</font>";
msg[7]="<font color='#333333'>Created in 1925 by the Northern States Power Co., <b>Reddy Kilowatt</b> is still a live wire.";
msg[8]="<font color='#333333'>One of advertising's most inspired icons,<b>The Michelin Man,</b> hit the road in 1898 and has never looked back.</font>";

function rollMessages(x) {
W=x;
Messages();
}

function Messages(){
if (ie){gerber.style.visibility='hidden';msgbox.style.visibility='visible';msgbox.innerHTML=msg[W]}
if (ns6){document.getElementById("gerber").style.visibility='hidden';document.getElementById("msgbox").style.visibility='visible';document.getElementById("msgbox").innerHTML=msg[W]}
if (ns){document.gerber.visibility='hide';document.msgbox.visibility='show';document.msgbox.document.write("<div style='position:absolute;top:0px;left:0px;height:20px;width:244px;font-family:Arial;font-size:12px;color:#000000'>"+msg[W]+"</div>");document.msgbox.document.close()}
}

function Clear(){
if (ie){gerber.style.visibility='visible';msgbox.innerHTML="<font color='#333333'>Rollover icons above to find out about them</font>"}
if (ns6){document.getElementById("gerber").style.visibility='visible';document.getElementById("msgbox").innerHTML="<font color='#333333'>Select icons above to find out about them</font>"}
if (ns){document.gerber.visibility='show';document.msgbox.document.write("<div style='position:absolute;top:0px;left:0px;height:20px;width:244px;font-family:Arial;font-size:12px;color:#000000'>select icons above to find out about them</a>");document.msgbox.document.close()}
}

if (ns||ns6){
window.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
document.releaseEvents(Event.MOUSEMOVE);
}


//Main drag n' drop
function down(e){
if (ns){
 if (document.layers['pics'+e.target.name]){
 window.onmousemove=move;
 z=document.layers['pics'+e.target.name];
 y=e.layerY;
 x=e.layerX;
 document.layers['pics'+e.target.name].zIndex=50;
 }
else {return true}
W=z.name.charAt(z.name.length-1);
Messages();
}
if (ie && window.event.srcElement.parentElement){
 if  (window.event.srcElement.parentElement.id.indexOf("pics") != -1){
 document.onmousemove=move;
 z=window.event.srcElement.parentElement; 
 y=window.event.offsetY;
 x=window.event.offsetX;
 window.event.srcElement.parentElement.style.zIndex=50;
 W=window.event.srcElement.parentElement.id.charAt(window.event.srcElement.parentElement.id.length-1);
 Messages(); 
 }
//window.status=event.y+'  '+event.x;//Easy pos finder.
}
if (ns6){
 if  (e.target.parentNode.id.indexOf("pics") != -1){
 document.onmousemove=move;
 z=e.target.parentNode.style;
 x=e.clientX - parseInt(z.left);
 y=e.clientY - parseInt(z.top);
 W=e.target.parentNode.id.charAt(e.target.parentNode.id.length-1);
 z.zIndex=50;
 Messages();
 }
 else 
 return true; 
}
return false;
}

function move(e){
if (ns && z){z.left=e.pageX-x;z.top=e.pageY-y}
if (ns6 && z){z.top=parseInt(e.clientY)-y;z.left=parseInt(e.clientX)-x}
if (ie && z){z.style.posLeft=window.event.clientX-x;z.style.posTop=window.event.clientY-y+window.document.body.scrollTop}
return false;
}

function up(e){
if (z)Check();
Clear();
if (ie){
for (i=0; i < 9; i++)document.all['pics'+i].style.zIndex=i+30
mouseY=event.y+window.document.body.scrollTop;mouseX=event.x;document.onmousemove=null;
}
if (ns6){
for (i=0; i < 9; i++)document.getElementById('pics'+i).style.zIndex=i+30
mouseY=e.pageY;mouseX=e.pageX;document.onmousemove=null;
}
if (ns){
for (i=0; i < 9; i++)document.layers['pics'+i].zIndex=i+30
mouseY=e.pageY;mouseX=e.pageX;window.onmousemove=null;
}
z=null;
snap();
W=null;
}
if (ns){window.onmousedown=down;window.onmouseup=up}
if (ie||document.getElementById){document.onmousedown=down;document.onmouseup=up}
