/* author: Gregory Marusik */
/* Generated by AceHTML Freeware http://freeware.acehtml.com */
/* Creation date: 2004-05-17 */
	<!--

	var uagent = navigator.userAgent;
	var appver = navigator.appVersion.substring(0,1);

	
	//use this function when Submit button pressed in Library page
	// this function will validated all query input box
	function searchOnTheWeb()
	{
		var SearchEngine=document.forms[0].engine.value ;
		var SearchQuery=document.forms[0].query.value ;
		var SearchURL =""
		
		if( SearchQuery=="" )
			alert( "Fill out search query...and enter Go" ) ;
		else if (SearchEngine=="alltheweb" ) {
			SearchURL = "http://www.alltheweb.com/search?cat=web&cs=utf8&q=" + SearchQuery + "&_sb_lang=pref"
			window.open ( SearchURL ) ;
		}
		else if (SearchEngine=="altavista" ) {
			SearchURL = "http://www.altavista.com/web/results?q=" + SearchQuery + "&kgs=1&kls=0"
			window.open ( SearchURL ) ;
		}
		else if (SearchEngine=="google" )	{
			SearchURL = "http://www.google.com/search?q=" + SearchQuery + "&ie=UTF-8&hl=sv&meta="
			window.open ( SearchURL ) ;
		}
		else if (SearchEngine=="imdb" )	{
			SearchURL = "http://www.imdb.com/find?tt=on;nm=on;mx=20;q=" + SearchQuery 
			window.open ( SearchURL ) ;
		}
		else if (SearchEngine=="webcrawler" )	{
			SearchURL = "http://msxml.webcrawler.com/info.wbcrwl/search/web/" + SearchQuery
			window.open ( SearchURL ) ;
		}
		else if (SearchEngine=="yahoo" )	{
			SearchURL = "http://search.yahoo.com/search?p=" + SearchQuery + "&ei=UTF-8&fr=fp-tab-web-t&cop=mss&tab="
			window.open ( SearchURL ) ;
		}
	}	

	// will clear all textboxes on Ticket page
	function buttonClearPressed()
	{
		document.forms.searchTicket.item.clear
	}
	// will clear all text boxes on Books page
	function buttonClearfrmBooks()
	{
		document.forms.frmBooks.item.clear
	}
	// will clear all text boxes on Books page
	function buttonClearfrmCards()
	{
		document.forms.frmCards.item.clear
	}

	// for future use
	function buttonUntitledPressed()
	{
		var today = new Date();
		var todaysDay = today.getDate();
		var todaysMonth = (today.getMonth() + 1);
		var todaysYear = today.getYear();
	
		document.forms.searchTicket.item("DateMonth").text = todaysDay
		document.forms.searchTicket.item("DateMonth").disabled = true;
		document.forms.searchTicket.item("DateDay").disabled = true;
		document.forms.searchTicket.item("DateYear").disabled = true;
		
		document.forms.searchTicket.item("DateMonth").CityName = todaysDay
		document.forms.searchTicket.item("DateMonth").PlaceName = todaysMonth

			
		document.write("<h1><center><br /><br /><br />");
		document.write("Under construction<br /><h3>");
		document.write(todaysYear);
		document.write("/");		
		document.write(todaysMonth);
		document.write("/");		
		document.write(todaysDay);		
	}
	
	
	//use this function when Submit button pressed in ticket pages
	// this function will validated all input boxes
	function buttonSubmitfrmTicket()
	{
		//var today = new Date();
		//var todaysDay = today.getDate();
		//var todaysMonth = (today.getMonth() + 1);
		//var todaysYear = today.getYear();		
	
		//document.forms.searchTicket.item("DateMonth").disabled = true;
		//document.forms.searchTicket.item("DateDay").disabled = true;
		//document.forms.searchTicket.item("DateYear").disabled = true;		
		
		//document.write( document.forms.searchTicket.item("EventName").value ) ;
		
		if ( document.forms.searchTicket.item("EventName").value=="" )
		{
			if ( document.forms.searchTicket.item("PlaceName").value=="" )	{
				alert ( "Please fill out the form" ) ;
				document.forms.searchTicket.item("warning1").value="*" ;
				//document.forms.searchTicket.item("warning2").value="*" ;
			}
		}
		else	{
			//alert("No such a event found i our database. Please try with another event..." ) ;
			parent.frames("MainFrameWindow").location.href = "http://student.kitcampus.com/projects/group4/gregory/signin.html" ;
			//document.forms.searchTicket.item("warning1").value="" ;
			//document.forms.searchTicket.item("EventName").value="" ;
			//document.forms.searchTicket.item("PlaceName").value="" ;
			//document.forms.searchTicket.item("CityName").value=="" ;
		}
		
		//document.write("<h1><center><br /><br /><br />");
		//document.write("Under construction<br /><h3>");
		//document.write(todaysYear);
		//document.write("/");		
		//document.write(todaysMonth);
		//document.write("/");		
		//document.write(todaysDay);		
	}
	
	
	
	//use this function when Submit button pressed in Books page
	// this function will validated all input boxes
	function buttonSubmitfrmBooks()
	{
		var title=document.forms[0].Title.value ; ; 
		var author=document.forms[0].Author.value ; 
		var isbn=document.forms[0].ISBN.value ;

		if ( title.length > 0 )
			//alert ( "Could not find in our database..." ) ;	
			parent.frames("MainFrameWindow").location.href = "http://student.kitcampus.com/projects/group4/gregory/shipping.html" ;
		
		if ( title=="" && author=="" && isbn=="" )	{
				document.forms.frmBooks.item("warning1").value="*" ;			
				document.forms.frmBooks.item("warning2").value="*" ;			
				document.forms.frmBooks.item("warning3").value="*" ;			
				alert ( "Please fill out the form" ) ;
		}
		
		if ( isbn.length == 10 )	
			alert ( "Could not find in our database..." ) ;	
		else	{
			if ( isbn.length > 0 )	
				alert ( "Wrong ISBN no. Try again..." ) ;	
		}
	}
	
	//use this function when Submit button pressed in Books page
	// this function will validated all input boxes
	function buttonSubmitfrmCards()
	{
		var q1=document.forms[0].Q1.value ; 
		var q2=document.forms[0].Q2.value ; 
		var q3=document.forms[0].Q3.value ;
		var q4=document.forms[0].Q4.value ;
		var q5=document.forms[0].Q5.value ;
		var q6=document.forms[0].Q6.value ;
		var q7=document.forms[0].Q7.value ;
		var q8=document.forms[0].Q8.value ;

		
		
		if ( q1=="0" && q2=="0" && q3=="0" && q4=="0" && q5=="0" && q6=="0" && q7=="0" && q8=="0" ) {
		// if ( isNAN(q1) || isNaN(q2) || isNaN(q3) || isNaN(q4) || isNaN(q5)|| isNaN(q6)|| isNaN(q7)|| isNaN(q8) ) {
			alert ( "Please fill out quantity.. Quantity is not a valid number..." ) ;	
		}
		else	{
			//open ( "http://student.kitcampus.com/projects/group4/gregory/signin.html" ) ;
			parent.frames("MainFrameWindow").location.href = "http://student.kitcampus.com/projects/group4/gregory/shipping.html" ;
			//<a href="http://student.kitcampus.com/projects/group4/gregory/signin.html"/>
			// alert ( "We need now your name & credit card no.." ) ;			
		}
	}

	// this function activates menu to avoid dbl clicking first time
	function activateMenu()
	{
	
		//if (document.all.menu1.style.display == 'none')	
		//	document.all.menu1.style.display = 'block' ;
		//else
		//	document.all.menu1.style.display = 'none' ;
			
		var i=0 ;
		for( i=1; i<12; i++ ) {
			onclick_Menu(i);
			//onclick_Menu(i);
		}
		document.all.menu1.style.display = 'none' ;
		document.all.menu2.style.display = 'none' ;
		document.all.menu3.style.display = 'none' ;
		document.all.menu4.style.display = 'none' ;
		document.all.menu5.style.display = 'none' ;
		document.all.menu6.style.display = 'none' ;
		document.all.menu7.style.display = 'none' ;
		document.all.menu8.style.display = 'none' ;
		document.all.menu9.style.display = 'none' ;
		document.all.menu10.style.display = 'none' ;
		document.all.menu11.style.display = 'none' ;
	}
		
	// as main menu service - show sub menu('style.display=block') or hide it (style.display='none') 
	function onclick_Menu( menu_no)
	{
		switch ( menu_no)
		{
			case 1:  // menu 1
				if (document.all.menu1.style.display == 'none')	
					document.all.menu1.style.display = 'block' ;
				else
					document.all.menu1.style.display = 'none' ;
			break ;
			case 2: // menu 2
				if (document.all.menu2.style.display == 'none')	
					document.all.menu2.style.display = 'block' ;
				else
					document.all.menu2.style.display = 'none' ;
			break ;		
			case 3: // menu 3
				if (document.all.menu3.style.display == 'none')	
					document.all.menu3.style.display = 'block' ;
				else
					document.all.menu3.style.display = 'none' ;
			break ;		
			case 4:
				if (document.all.menu4.style.display == 'none')	
					document.all.menu4.style.display = 'block' ;
				else
					document.all.menu4.style.display = 'none' ;
			break ;		
			case 5:
				if (document.all.menu5.style.display == 'none')	
					document.all.menu5.style.display = 'block' ;
				else
					document.all.menu5.style.display = 'none' ;
			break ;		
			case 6:
				if (document.all.menu6.style.display == 'none')	
					document.all.menu6.style.display = 'block' ;
				else
					document.all.menu6.style.display = 'none' ;
			break ;		
			case 7:
				if (document.all.menu7.style.display == 'none')	
					document.all.menu7.style.display = 'block' ;
				else
					document.all.menu7.style.display = 'none' ;
			break ;		
			case 8:
				if (document.all.menu8.style.display == 'none')	
					document.all.menu8.style.display = 'block' ;
				else
					document.all.menu8.style.display = 'none' ;
			break ;		
			case 9:
				if (document.all.menu9.style.display == 'none')	
					document.all.menu9.style.display = 'block' ;
				else
					document.all.menu9.style.display = 'none' ;
			break ;		
			case 10:
				if (document.all.menu10.style.display == 'none')	
					document.all.menu10.style.display = 'block' ;
				else
					document.all.menu10.style.display = 'none' ;
			break ;		
			default:
				if (document.all.menu11.style.display == 'none')	
					document.all.menu11.style.display = 'block' ;
				else
					document.all.menu11.style.display = 'none' ;
			break;
		}
	}	

// function used in cards pages to hightlight background
function highlight()
{
	if (event.srcElement.tagName=="TD")
		event.srcElement.style.backgroundColor = 'yellow' ;
}

function normallight()
{
	if (event.srcElement.tagName=="TD")
		event.srcElement.style.backgroundColor = 'white' ;
}


function showTip(ctrl, tiptext) {
	var tipdiv;

	if (uagent.indexOf("MSIE") != -1) {
		if (appver > 3) {
			// in IE all we need to do is set the "title" attribute
			ctrl.title = tiptext;	
		}
	} 
	else {
		if ((uagent.indexOf("Mozilla") != -1) && (appver > 3)) {
			tipdiv = document.layers["tooltip"];

			// set the tooltip text
			tipdiv.document.open();
			tipdiv.document.write("<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2 bordercolor=black><TR><TD BGCOLOR=FFFFCC>");
			tipdiv.document.write("<FONT FACE=Verdana, Arial, Helvetica SIZE=-2>");
			tipdiv.document.write(tiptext);
			tipdiv.document.write("</FONT>");
			tipdiv.document.write("</TD></TR></TABLE>");
			tipdiv.document.close();

			// set the tooltip location and show it
			tipdiv.top = ctrl.y + 20; 
			tipdiv.left = ctrl.x + 10;
			tipdiv.visibility = "show";
		}
	}
}

function showTipMSIE(ctrl, tiptext) {
	ctrl.title = tiptext;	
}

function hideTip() {
	if ((uagent.indexOf("MSIE") == -1) && (uagent.indexOf("Mozilla") != -1) && (appver > 3)) {
		// only do this for NN4+
		document.layers["tooltip"].visibility = "hidden";
	}
}

function helpPopWin(url,name,options){
  //var ContextWindow = window.open(url,name,options);
  //ContextWindow.focus();
  return false;
}

function fnFocus()
{
    if(document.signin.email.value == '' )
    {
      document.signin.email.focus();
    }
    else
    {
     document.signin.password.focus();
    }
}

function ValidateShippingForm()
{
		var q1=document.forms[0].name.value ; 
		var q2=document.forms[0].address1.value ; 
		var q3=document.forms[0].address2.value ;
		var q4=document.forms[0].city.value ;
		var q5=document.forms[0].state.value ;
		var q6=document.forms[0].zip.value ;
		var q7=document.forms[0].voice.value ;

		if ( q1=="" ) alert ( "Please fill out the name field" ) ;	
		if ( q2=="" ) alert ( "Please fill out the address1 field" ) ;	
		if ( q3=="" ) alert ( "Please fill out the address2 field" ) ;	
		if ( q4=="" ) alert ( "Please fill out the city field" ) ;	
		if ( q5=="" ) alert ( "Please fill out the state field" ) ;	
		if ( q6=="" ) alert ( "Please fill out the zip field" ) ;	
		if ( q7=="" ) alert ( "Please fill out the phone field" ) ;	
		
		if( q1="" || q2=="" || q3=="" || q4=="" || q5=="" || q6=="" || q7=="" ) {
			
		}
		else	{
			parent.frames("MainFrameWindow").location.href = "http://student.kitcampus.com/projects/group4/gregory/signin.html" ;
		}
}

function ClearShippingForm()
{
		document.forms[0].name.value = "" ; 
		document.forms[0].address1.value = "" ; 
		document.forms[0].address2.value = "" ; 
		document.forms[0].city.value = "" ; 
		document.forms[0].state.value = "" ; 
		document.forms[0].zip.value = "" ; 
		document.forms[0].voice.value = "" ; 
}

//windowOpen for Shopping page
function winpopShopping()
{
	open("http://student.kitcampus.com/projects/group4/pictures/banner.jpg","nada","width=230,height=210,scrollbars=no,menubar=no");
}


function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}


	-->	
	