function ajaxrequest(fileurl, elementid, query) {	try { 		var xmlhttp = new XMLHttpRequest();	}	catch (error)	{ 		try{   			var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 		} 		catch (error) {		   return false; 		}	}	xmlhttp.open('POST', fileurl, true);	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xmlhttp.send(query);	xmlhttp.onreadystatechange = function() {		if (xmlhttp.readyState == 4) {			 document.getElementById(elementid).innerHTML=xmlhttp.responseText;		}	}}        function swapElementstyle(div_id, styleProperty, newValue)		{		  var style_sheet = getStyleObject(div_id);		  if (style_sheet)		  {		    style_sheet.styleProperty = newValue;		  }		}		        function switchDiv(div_id, newVisibility)		{		  var style_sheet = getStyleObject(div_id);		  if (style_sheet)		  {		    style_sheet.display = newVisibility;		  }		}		function getStyleObject(objectId) 		{  		if(document.getElementById && document.getElementById(objectId)) {		return document.getElementById(objectId).style;   		}   		else if (document.all && document.all(objectId)) {  		return document.all(objectId).style;   		}    		else if (document.layers && document.layers[objectId]) { 		return document.layers[objectId];   		}    		else {		return false;   		}		}function swapItem(n){ removeItem('cat_image'); var root = document.getElementById('cat_image'); var im = document.createElement('img'); im.setAttribute('src', '/brinksg/catalog_m/'+n); root.appendChild(im);}function swapColor(n){ removeItem('cat_current_color'); var root = document.getElementById('cat_current_color'); var txt = document.createTextNode(n); root.appendChild(txt);}function removeItem(div_id){  var root = document.getElementById(div_id);  while(root.hasChildNodes())  {   root.removeChild(root.childNodes[0])  }}function submitenter(field,e,form){var keycode;if (window.event) keycode = window.event.keyCode;else if (e) keycode = e.which;else return true;if (keycode == 13)   {   form();   return false;   }else   return true;}function submitlogin(){	if (document.login.user_loginname.value=='')	{		alert ("Please enter your Username.");	}	else if (document.login.user_md5password.value=='')	{		alert ("Please enter your Password.");	}	else {    document.login.submit();	}}function submitlogout(){document.logout.submit();}function submitWholeLogin(){	if (document.whole_login.name.value=='') {    alert ("Please enter your Retailer Login Name.");	}	else if (document.whole_login.password.value=='') {    alert ("Please enter your Retailer Password.");	}	else {    document.whole_login.submit();	}}function user_forgot(){if (document.forgot.name.value==""){alert("Please enter your Username.");}else if (document.forgot.email.value==""){alert("Please enter your email address.");}else{document.forgot.submit();}}function submitWholeForgot(){if (document.whole_forgot.name.value=="") {alert ("Please enter the Store Name.");}else if (document.whole_forgot.email.value=="") {alert ("Please enter the Store Owner's email address.");}else{document.whole_forgot.submit();}}function submitWholeLogout(){document.whole_logout.submit();}function submitClient(){var error=0; if (document.whole_reg.store_name.value=="") {    switchDiv('store_name','block');	error+=1; } else if (document.whole_reg.store_name.value!=="") {	 switchDiv('store_name','none'); } if (document.whole_reg.store_address.value=="") {    switchDiv('store_address','block');	error+=1; } else if (document.whole_reg.store_address.value!=="") {	 switchDiv('store_address','none'); } if (document.whole_reg.store_city.value=="") {	switchDiv('store_city','block');  	error+=1; } else if (document.whole_reg.store_city.value!=="") {	 switchDiv('store_city','none'); } if (document.whole_reg.store_state.value=="") {	switchDiv('store_state','block');		error+=1; } else if (document.whole_reg.store_state.value!=="") {	 switchDiv('store_state','none'); } if (document.whole_reg.store_zip.value=="") {	switchDiv('store_zip','block'); 	error+=1; } else if (document.whole_reg.store_zip.value!=="") {	 switchDiv('store_zip','none'); }	if (document.whole_reg.store_country.value=="") {	switchDiv('store_country','block'); 	error+=1; } else if (document.whole_reg.store_country.value!=="") {	 switchDiv('store_country','none'); } 	if (document.whole_reg.store_phone.value=="") {	switchDiv('store_phone','block');	error+=1; } else if (document.whole_reg.store_phone.value!=="") {	 switchDiv('store_phone','none'); }  	if (document.whole_reg.store_website.value=="") {	switchDiv('store_website','block');	error+=1; } else if (document.whole_reg.store_website.value!=="") {	 switchDiv('store_website','none'); }selected = ""len = document.whole_reg.onsite_purchase.lengthfor (i = 0; i <len; i++) {if (document.whole_reg.onsite_purchase[i].checked) {selected = document.whole_reg.onsite_purchase[i].value}}if (selected == "") {	switchDiv('onsite_purchase','block');	error+=1;}else {switchDiv('onsite_purchase','none');} 	if (document.whole_reg.store_owner.value=="") {	switchDiv('store_owner','block'); 	error+=1; } else if (document.whole_reg.store_owner.value!=="") {	 switchDiv('store_owner','none'); } 	if (document.whole_reg.store_owner_phone.value=="") {	switchDiv('store_owner_phone','block');	error+=1; } else if (document.whole_reg.store_owner_phone.value!=="") {	 switchDiv('store_owner_phone','none'); } 	if (document.whole_reg.store_owner_email.value=="") {	switchDiv('store_owner_email','block');	error+=1; } else if (document.whole_reg.store_owner_email.value!=="") {	 switchDiv('store_owner_email','none'); }	if (document.whole_reg.store_buyer_name.value=="" && !document.whole_reg.buyer_same.checked) {	switchDiv('store_buyer_name','block');	error+=1; } else if (document.whole_reg.store_buyer_name.value!=="" || document.whole_reg.buyer_same.checked) {	 switchDiv('store_buyer_name','none'); }	if (document.whole_reg.store_buyer_phone.value=="" && !document.whole_reg.buyer_same.checked) {	switchDiv('store_buyer_phone','block');	error+=1; } else if (document.whole_reg.store_buyer_phone.value!=="" || document.whole_reg.buyer_same.checked) {	 switchDiv('store_buyer_phone','none'); }	if (document.whole_reg.store_buyer_email.value=="" && !document.whole_reg.buyer_same.checked) {	switchDiv('store_buyer_email','block');	error+=1; } else if (document.whole_reg.store_buyer_email.value!=="" || document.whole_reg.buyer_same.checked) {	 switchDiv('store_buyer_email','none'); }    if (document.whole_reg.reference.value=="") {	switchDiv('ref','block');	error+=1; } else if (document.whole_reg.reference.value!=="") {	 switchDiv('reference','none'); } 	if (document.whole_reg.brand1.value=="") {	switchDiv('brand1','block');	error+=1; } else if (document.whole_reg.brand1.value!=="") {	 switchDiv('brand1','none'); } 	if (document.whole_reg.brand2.value=="") {	switchDiv('brand2','block');	error+=1; } else if (document.whole_reg.brand2.value!=="") {	 switchDiv('brand2','none'); } 	if (document.whole_reg.brand3.value=="") {	switchDiv('brand3','block');	error+=1; } else if (document.whole_reg.brand3.value!=="") {	 switchDiv('brand3','none'); } 	if (document.whole_reg.brand4.value=="") {	switchDiv('brand4','block');	error+=1; } else if (document.whole_reg.brand4.value!=="") {	 switchDiv('brand4','none'); } 	if (document.whole_reg.brand5.value=="") { 	switchDiv('brand5','block');	error+=1; } else if (document.whole_reg.brand5.value!=="") {	 switchDiv('brand5','none'); }if (document.whole_reg.ages.value == "") { 	switchDiv('age1','block');	error+=1; } else if (document.whole_reg.ages.value != "") {	 switchDiv('age1','none'); } 	if (!document.whole_reg.cat1.checked && !document.whole_reg.cat2.checked && !document.whole_reg.cat3.checked && !document.whole_reg.cat4.checked && !document.whole_reg.cat5.checked && !document.whole_reg.cat6.checked && !document.whole_reg.cat7.checked && !document.whole_reg.cat8.checked && !document.whole_reg.cat9.checked && !document.whole_reg.cat10.checked && !document.whole_reg.cat11.checked) { 	switchDiv('cat1','block');	error+=1; } else if (document.whole_reg.cat1.checked || document.whole_reg.cat2.checked || document.whole_reg.cat3.checked || document.whole_reg.cat4.checked || document.whole_reg.cat5.checked || document.whole_reg.cat6.checked || document.whole_reg.cat7.checked || document.whole_reg.cat8.checked || document.whole_reg.cat9.checked || document.whole_reg.cat10.checked || document.whole_reg.cat11.checked) {	 switchDiv('cat1','none'); } if (error>0){alert ("Please correct the fields marked with red dots.");}											else{document.whole_reg.submit();}}function submitRegister() {var errors=0;var terms=0; if (document.registration.reg_email.value=="") { switchDiv('reg_email','block'); errors+=1; } else if (document.registration.reg_email.value!=="") { switchDiv('reg_email','none'); }  if (document.registration.reg_email_confirm.value=="") {   switchDiv('reg_email_confirm','block');   errors+=1;  } else if (document.registration.reg_email_confirm.value!=="") { switchDiv('reg_email_confirm','none'); }  if (document.registration.reg_username.value=="") {   switchDiv('reg_username','block');   errors+=1;  } else if (document.registration.reg_username.value!=="") { switchDiv('reg_username','none'); }  if (document.registration.reg_password.value=="") {   switchDiv('reg_password','block');   errors+=1;  } else if (document.registration.reg_password.value!=="") { switchDiv('reg_password','none'); }  if (document.registration.reg_password_confirm.value=="") {   switchDiv('reg_password_confirm','block');   errors+=1;  } else if (document.registration.reg_password_confirm.value!=="") { switchDiv('reg_password_confirm','none'); }  if (document.registration.reg_firstname.value=="") {   switchDiv('reg_firstname','block');   errors+=1;  } else if (document.registration.reg_firstname.value!=="") { switchDiv('reg_firstname','none'); }  if (document.registration.reg_age.value=="") {   switchDiv('reg_age','block');   errors+=1;  } else if (document.registration.reg_age.value!=="") { switchDiv('reg_age','none'); }  if (document.registration.reg_city.value=="") {   switchDiv('reg_city','block');   errors+=1;  } else if (document.registration.reg_city.value!=="") { switchDiv('reg_city','none'); }  if (document.registration.reg_state.value=="") {   switchDiv('reg_state','block');   errors+=1;  } else if (document.registration.reg_state.value!=="") { switchDiv('reg_state','none'); }  if (document.registration.reg_zip.value=="") {   switchDiv('reg_zip','block');   errors+=1;  } else if (document.registration.reg_zip.value!=="") { switchDiv('reg_zip','none'); }  if (document.registration.reg_country.value=="") {   switchDiv('reg_country','block');   errors+=1;  } else if (document.registration.reg_country.value!=="") { switchDiv('reg_country','none'); }  if (!document.registration.reg_ref_friend.checked && !document.registration.reg_ref_told.checked && !document.registration.reg_ref_store.checked && !document.registration.reg_ref_radio.checked && !document.registration.reg_ref_web.checked && !document.registration.reg_ref_magazine.checked && !document.registration.reg_ref_event.checked && !document.registration.reg_ref_tv.checked && !document.registration.reg_ref_other.checked) {   switchDiv('reg_ref','block');   errors+=1;  } else if (document.registration.reg_ref_friend.checked || document.registration.reg_ref_told.checked || document.registration.reg_ref_store.checked || document.registration.reg_ref_radio.checked || document.registration.reg_ref_web.checked || document.registration.reg_ref_magazine.checked || document.registration.reg_ref_event.checked || document.registration.reg_ref_tv.checked || document.registration.reg_ref_other.checked) { switchDiv('reg_ref','none'); }  if (!document.registration.reg_terms.checked) {   switchDiv('reg_terms','block');   terms+=1;  } else if (document.registration.reg_terms.checked) { switchDiv('reg_terms','none'); }if (errors>0){   alert ("Please correct the fields marked with a star.");}else if (terms>0){	alert ("Please check the user agreement and privacy policy.");}  else if (document.registration.reg_email.value !== document.registration.reg_email_confirm.value && errors==0) {   switchDiv('reg_email','block');   switchDiv('reg_email_confirm','block');   alert("Please make sure both your email address and your email address confirmed fields match."); } else if (document.registration.reg_email.value == document.registration.reg_email_confirm.value && errors>0) {   switchDiv('reg_email','none');   switchDiv('reg_email_confirm','none');   } else if (document.registration.reg_password.value !== document.registration.reg_password_confirm.value && errors==0) {   switchDiv('reg_password','block');   switchDiv('reg_password_confirm','block');   alert ("Please make sure both your password and your password confirmed fields match."); } else if (document.registration.reg_password.value == document.registration.reg_password_confirm.value && errors>0) {   switchDiv('reg_password','none');   switchDiv('reg_password_confirm','none');   } else {  document.registration.submit(); }}function submit_email_interview(){if (document.email_mp3.target_email.value=="") {switchDiv ('target_email','block');  if (document.email_mp3.user_email.value=="") {  switchDiv ('user_email','block');    if (document.email_mp3.user_name.value=="") {    switchDiv ('user_name','block');     }   }   alert ("Please correct the fields marked with a star.");  } else{document.email_mp3.submit();}}function submitContact() { if (document.contact.name.value=="") { switchDiv ('name','block');   if (document.contact.email.value=="") {   switchDiv ('email','block');     if (document.contact.email_confirm.value=="") {     switchDiv ('email_confirm','block');       if (document.contact.subject.value=="") {       switchDiv ('subject','block');        if (document.contact.body.value=="") {        switchDiv ('body','block');         }       }      }     }     alert ("Please correct the fields marked with a star.");    }  else if (document.contact.email.value !== document.contact.email_confirm.value) { alert ("Please make sure your email address matches the confirm email address"); } else {  document.contact.submit(); }}function downloadCD(mix_id, user_id){	ajaxrequest('/brinksg/back_handler_mix.php?mix_log=1&mix_id=' + mix_id + '&user_id=' + user_id, 'results', '');	window.location = '/brinksg/mp3_mixes/Soundgirl Mix Vol ' + mix_id + '.zip';}