function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function areYouSure()
{
	conf = confirm("Are you sure?");
	if (conf)
		return true
	else
		return false;
}

function LaunchWindow(url,name,features)
{
	var newwindow;
	newwindow=window.open(url,name,features);
	if (window.focus) {newwindow.focus()}
}

 function doClear(searchbartext) {
     if (searchbartext.value =="Search...") {
         searchbartext.value = ""
		 }
}
	function verify_basket() {
		// change span to "Please Wait" graphic & text
		dynamic_span_obj = document.getElementById( 'pleasewait' );
		var text='<img src="../images/loading.gif" width="35" height="35" alt="Please wait" align="absmiddle" /> Please wait...';
		dynamic_span_obj.innerHTML = text;

		first_name_obj = document.getElementById( 'first_name' );
		last_name_obj = document.getElementById( 'last_name' );
		add1_obj = document.getElementById( 'address1' );
		add2_obj = document.getElementById( 'address2' );
		town_obj = document.getElementById( 'town' );
		county_obj = document.getElementById( 'county' );
		pcode_obj = document.getElementById( 'pcode' );
		country_obj = document.getElementById('country');
		email_obj = document.getElementById( 'email' );
		shipping_code_obj = document.getElementById( 'shipping_code' );
		base_shipping_obj = document.getElementById( 'base_shipping' );
		shipping_obj = document.getElementById('shipping_1');
		script = document.createElement( 'script' );
		script.src = 'val_form.php?email=' + email_obj.value + '&first_name=' + first_name_obj.value + '&last_name=' + last_name_obj.value + '&address_1=' + add1_obj.value + '&address_2=' + add2_obj.value + '&town=' + town_obj.value + '&county=' + county_obj.value + '&country=' + country_obj.value + '&shipping_code=' + shipping_code_obj.value + '&base_shipping=' + base_shipping_obj.value + '&shipping_1=' + shipping_obj.value + '&pcode=' + pcode_obj.value;
		head_tag = document.getElementsByTagName( 'head' )[0];
		head_tag.appendChild( script );
		}
		
function do_shipping() {
		country_menu = document.getElementById('shipping_code');
		selected_country = country_menu.selectedIndex;

		country_obj = document.getElementById('country');
		country_obj.value = country_menu.options[selected_country].text;
			
		base_shipping_obj = document.getElementById('base_shipping');
		shipping_obj = document.getElementById('shipping_1');
		total_shipping_price = country_menu.value * base_shipping_obj.value
		shipping_obj.value = total_shipping_price.toFixed(2);		
		
		if (country_obj.value!="Please select...")
			post_country_text = 'Shipping to ' + country_obj.value + ':';
			post_country_obj = document.getElementById('post_country');
			post_country_obj.innerHTML = post_country_text;
			post_amount_display_obj = document.getElementById('post_amount_display');
			post_amount_display_obj.innerHTML = '&pound;' + shipping_obj.value;
		}
		
function find_show( p_script_url ) {
	if (document.getElementById('wcdate').value!='') {
		document.getElementById('dynamic_span').innerHTML = '<img src="../../../images/loading.gif" alt="Please wait..." title="Please wait..." style="vertical-align:middle" /> <span style="font-weight:bold">Please wait...</span><br />&nbsp;';
		script = document.createElement( 'script' );
		script.src = p_script_url;
		document.getElementsByTagName( 'head' )[0].appendChild( script );
		}
	}	
	
function find_mix( p_script_url ) {
	// create new script element, set its relative URL, and load it
	if (mp3link.value!='') {
		dynamic_span_obj = document.getElementById( 'dynamic_span' );
		dynamic_span_obj.innerHTML = '<img src="../../../images/loading.gif" alt="Please wait..." title="Please wait..." style="vertical-align:middle" /> <span style="font-weight:bold">Please wait...</span><br />&nbsp;';
		script = document.createElement( 'script' );
		script.src = p_script_url;
		document.getElementsByTagName( 'head' )[0].appendChild( script );
		}
	}	

function OpenAndFocus(url,name,features)
{
	var newwindow;
	newwindow=window.open(url,name,features);
	if (window.focus) {newwindow.focus()}
}

function ShowAndHideRecent()
{
	recent_shows_text = document.getElementById( 'recent_text' );
	script = document.createElement( 'script' );
	script.src = 'get_recent.php?recent_box_text=' + recent_shows_text.value;
	head_tag = document.getElementsByTagName( 'head' )[0];
	head_tag.appendChild( script );
}

function add_to_newsletter()
{
	var newsletter_area = document.getElementById('newsletter_span');
	var newsletter_email_add = document.getElementById('newsletter_email').value;
	newsletter_area.innerHTML='<img src="http://www.basic-soul.co.uk/images/bk_loading.gif" style="width:18px;height:18px; vertical-align:middle" alt="Please wait" /> Please wait...';
	script = document.createElement('script');
	script.src = 'http://www.basic-soul.co.uk/includes/add_to_newsletter.php?email='+newsletter_email_add;
	head_tag = document.getElementsByTagName('head')[0];
	head_tag.appendChild(script);
}

function show_newsletter()
{
	var newsletter_area = document.getElementById('newsletter_span');
	newsletter_area.innerHTML="<input type=\"text\" value=\"email address\" style=\"width:80px\" onclick=\"clickclear(this,'email address');\" onblur=\"clickrecall(this,'email address')\" id=\"newsletter_email\" /> <input type=\"button\" style=\"background-color:#003399; color:#FFFFFF; font-size:10px\" value=\"Join newsletter\" onclick=\"add_to_newsletter();\" />";
}

function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}
