function send_order(){

	disguise('button')
	reveal('message')
	//document.forms['go_shopping'].submit();

}


function changestyle(objRow,className) {
	document.getElementById(objRow).className=className;
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}


var hasDom=true;
var hasAll=document.all;
var hasNSDom=document.layers;

function disguise() {
	var ary=disguise.arguments;
	for(a=0;a<ary.length;a++) {
			var name=ary[a];
			if (hasDom) {
					var lyrStyle=document.getElementById("lyr_"+name).style;
					lyrStyle.display="none";
			}
	}
}

function reveal() {
	var ary=reveal.arguments;
	for(a=0;a<ary.length;a++) {
	var name=ary[a];
			if (hasDom) {
				var lyrStyle=document.getElementById("lyr_"+name).style;
				lyrStyle.display="block";
			}

	}
}

var set_name

function show(name) {
	if ( set_name ) {
		disguise(set_name)
	}
	reveal(name)
	set_name=name
	
}

function hide(name) {
	disguise(name)
	set_name=null
}
	
var curNum = 1;	
function nextResult	( num ) {
	disguise('result_'+curNum)
	reveal('result_'+num)
	curNum=num
}
	

// Set the variable toggle_value in the page you want to use this function
function toggle_advanced(name, layer_name) {
	if ( toggle_value ) {
		reveal(name)
		toggle_value = 0
		//document.getElementById(layer_name).value = "1"
	} else {
		disguise(name)
		toggle_value = 1
		//document.getElementById(layer_name).value = "0"
	}
}

	
setActiveStyleSheet('');
function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}
function getActiveStyleSheet() {
var i, a;
 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
  if(a.getAttribute("rel").indexOf("style") != -1
  && a.getAttribute("title")
  && !a.disabled) return a.getAttribute("title");
  }
  return null;
}
	
var preloadFlag = true;

function updateBasket(id, type, item_format){
	
	//var item_format = document.shop_popup.shop_item_format.value;
	//var item_format = 'hard'
	
	if ( !item_format ) {
		window.alert("You need to selet a format.")
		return
	} //else window.alert(item_format)
	
	if ( item_format == 'seminar') {
		var slocOK=false;			
		var seminarloc = document.getElementById("sloc"+id).value;
		
		if (seminarloc =='' || seminarloc =='0') {
			window.alert("You need to select a venue.");
			slocOK = false;			
			return;
		} 
		else {			
			var seminardate = document.getElementById("sdate"+id).value;
			if (seminardate =='' || seminardate =='0') {
				window.alert("You need to select date & time.");
				slocOK = false;				
				return;
			} else {
				slocOK = true;
			}
		}		
	}
	
	if ( window.confirm("Do you want to add this item to your shopping cart?") ) {
		
		//var searchstring=document.getElementById('search').value;
		
		var xmlhttp=false; //Clear our fetching variable
	        try {
	                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
	        } catch (e) {
	                try {
	                        xmlhttp = new
	                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
	            } catch (E) {
	                xmlhttp = false;
	                        }
	        }
	        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
	        }
	        //if seminar, get dropdown values
	        if (item_format =='seminar') {	        	
	        	var seminar_id = document.getElementById("sdate"+id).value;
	        	var seminar_qty = document.getElementById("sqty"+id).value;
	       		var file = '/shopping_basket_contents.php?id='+id+'&item_format='+item_format+'&seminar_id='+seminar_id+'&seminar_qty='+seminar_qty;
	        } else {
	        	var file = '/shopping_basket_contents.php?id='+id+'&item_format='+item_format; //This is the path to the file we just finished making *
	        }
		    xmlhttp.open('GET', file, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
		    xmlhttp.onreadystatechange=function() {
		        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
		                var content = xmlhttp.responseText; //The content data which has been retrieved ***
		                if( content ){ //Make sure there is something in the content variable
		                      document.getElementById('shopping_basket').innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
		                }
		        }
	        }
	        //if ( window.confirm("Do you want to proceed to the checkout now?") ) {
			//	window.location="/shopping-basket/"
			//}
		xmlhttp.send(null) //Nullify the XMLHttpRequest
        
		if (item_format == 'seminar') {
			view_checkout();
		} else {
			return;
		}
	
	}
	

}

function view_checkout() {

	if ( window.confirm("Do you want to proceed to the checkout now?") ) {
		//window.location=url
		window.location="/shopping-basket/"
	}

}

function open_flash(url, targetId) {
	var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = '/elements/swf/main.php'; //This is the path to the file we just finished making *
	    xmlhttp.open('GET', file, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
	    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
                if( content ){ //Make sure there is something in the content variable
                      document.getElementById('flashBox').innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}


// switch password input 
   function replacePass(q){
        if (q){
            document.getElementById('passwordtext').style.display="none";
            document.getElementById('password').style.display="inline";
            document.getElementById('password').focus();
        } else {
            document.getElementById('password').style.display="none";
            document.getElementById('passwordtext').style.display="inline";
        }
   }

