var currentObject;
var blink=0;
var timeWait = 100;

function initialize7()
{
//drawEnterSerial();		//draw a form
//timeWait = 100;
if (blink ==0)
{
blinkyBattle();
}
timeWait = 100;
blink = 0;

$('Serial_Form').onsubmit = function() { submitSerial(); }
$('Enter_Serial_Block').onclick = function() { $('Enter_Serial_Block').value='';}
currentObject = 0;
$('battle').onclick = function () {
									blink = 2;
									drawBootyBattle();
									}

}


function drawEnterSerial()
{
var url = root+'/drawEnterSerial.php';
var pars = {r:root};
var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars,
onComplete: drawEnterSerialResponse
     } );
}

function drawEnterSerialResponse(originalRequest)
{
	var newData = originalRequest.responseText;
	$('Enter_Serial_Block').innerHTML = newData; 
}


function submitSerial()
{
var url = root+'/submitSerial.php';
var pars = Form.serialize('Serial_Form');
var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars, onComplete: submitSerialResponse
     } );
}
var WRvis =0;
var share=0;
var keep=0;
var change=0;
var flush=0;

function submitSerialResponse(originalRequest)
{
	var newData = originalRequest.responseText;
	$('2over3').innerHTML = newData; 
	drawPossibleContent();

	$('wr').onclick = function() {
									if (WRvis==0)
									{
									$('Warning_Rules').style.display='block';
									WRvis=1;
									}
									else
									{
									$('Warning_Rules').style.display='none';
									WRvis=0;
									}
									}
	$('wr').onmouseover = function() {$('wr').style.color='rgb(255,255,255)';}
	$('wr').onmouseout = function() {$('wr').style.color='rgb(255,10,103)';}
	
	//$('change').onmouseover = function() {$('change').style.color='rgb(100,100,100)';}
	//$('change').onmouseout = function() {$('change').style.color='rgb(0,0,0)';}	
	//$('flush').onmouseover = function() {$('flush').style.color='rgb(100,100,100)';}
	//$('flush').onmouseout = function() {$('flush').style.color='rgb(0,0,0)';}
	/*
	$('change').onclick = function() {
									if (change==0)
									{
									$('Change_Text').style.display='block';
									change=1;
									}
									else
									{
									$('Change_Text').style.display='none';
									change=0;
									}
									}
	*/
	/*								
	$('flush').onclick = function() {
									if (flush==0)
									{
									$('Flush_Text').style.display='block';
									flush=1;
									}
									else
									{
									$('Flush_Text').style.display='none';
									flush=0;
									}
									}
	*/
	/*	
	$('share').onmouseover = function() {$('share').style.color='rgb(100,100,100)';}
	$('share').onmouseout = function() {$('share').style.color='rgb(0,0,0)';}
	$('keep').onmouseover = function() {$('keep').style.color='rgb(100,100,100)';}
	$('keep').onmouseout = function() {$('keep').style.color='rgb(0,0,0)';}
	$('keep').onclick = function() {
									if (keep==0)
									{
									$('Keep_Text').style.display='block';
									keep=1;
									}
									else
									{
									$('Keep_Text').style.display='none';
									keep=0;
									}
									}
	$('share').onclick = function() {
									if (share==0)
									{
									$('Share_Text').style.display='block';
									share=1;
									}
									else
									{
									$('Share_Text').style.display='none';
									share=0;
									}
									}
	*/
	$('Path_Form').onsubmit = function() 	{ 	
											submitNewContent();
										   	$('Path_Input').value='';
										   	}
	$('Path_Input').onclick = function() 	{ 	
											$('Path_Input').value='';
											}
}
//A65950723C



function drawPossibleContent()
{
var url = root+'/drawPossibleContent.php';
var pars = {r:root};
var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars, onComplete: drawPossibleContentResponse
     } );
}

function drawPossibleContentResponse(originalRequest)
{
	var newData = originalRequest.responseText;
	$('Possible_Content').innerHTML = newData;
}

function submitNewContent()
{
var url = root+'/submitNewContent.php';
var pars = Form.serialize('Path_Form');
var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars, onComplete: submitNewContentResponse
     } );
}

function submitNewContentResponse(originalRequest)
{
	var newData = originalRequest.responseText;
	$('Submit_Serial_Message').innerHTML = newData; 
	drawPossibleContent();
}


function blinkyBattle()
{
if (blink == 0)
{
$('battle').style.color='rgb(0,255,0)';
blink = 1;
timeWait = 100;
}
else if (blink ==1)
{
$('battle').style.color='rgb(0,0,0)';
blink = 0;
timeWait = 100;
}
else 
{
blink =2;
timeWait = 100000;
}
setTimeout ("blinkyBattle()", timeWait);
}

function drawBootyBattle()
{
var url = root+'/drawBootyBattle.php';
var pars = {r:root};
var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars, onComplete: drawBootyBattleResponse
     } );
}

function drawBootyBattleResponse(originalRequest)
{
	var newData = originalRequest.responseText;
	$('7_Main_Area').innerHTML = newData;
	//$('Battle_Form').style.display='none';
	$('Battle_Form').onsubmit = function() { 
											//alert("battle");
											submitBootyBattle();
											}
	$('Pirate_1_Block').onclick = function() { $('Pirate_1_Block').value='';}
	$('Pirate_2_Block').onclick = function() { $('Pirate_2_Block').value='';}
	$('back').onclick = function() { eight(); }
}

function submitBootyBattle()
{
	var url = root+'/submitBootyBattle.php';
	var pars = Form.serialize('Battle_Form');
	var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars, onComplete: submitBootyBattleResponse
     } );
}

function submitBootyBattleResponse(originalRequest)
{
	var newData = originalRequest.responseText;
	$('Battle_Zone').innerHTML = newData; 
	drawPossibleContent();
	//make flashy win visible
}