function getQueryVariable(variable) {var query=window.location.search.substring(1);vars=query.split("&");for (var i=0;i<vars.length;i++){var pair=vars[i].split("=");if (pair[0]==variable){return pair[1];}}return false;}
function skVoid(){}
function isWhitespace(charToCheck){var whitespaceChars=" \t\n\r\f";return (whitespaceChars.indexOf(charToCheck) != -1);}
function ltrim(str){for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);return str.substring(k, str.length);}
function rtrim(str){for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)); j--);return str.substring(0,j+1);}
function trim(str){return ltrim(rtrim(str));}
function changeCSS(thisId,changeTo) {if (thisElement = document.getElementById(thisId)) {thisElement.className = changeTo;}}
function skToggleVisibility(id) {if (e = document.getElementById(id)) {if(e.style.display == 'none') {e.style.display = 'block';} else {e.style.display = 'none';}}}
function newImage(arg){
if(document.images){
rslt=new Image()
rslt.src=arg
return rslt}}
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 preloadFlag=false
function preloadImages(){
spacerIMG			= newImage("/images/spacer.gif");
spinningSK			= newImage("/images/spinning_skx.gif");
bigLoadingImage 	= newImage("/images/bigloading.gif");
tinyLoadingImage 	= newImage("/images/tinyloading.gif");
houndImage 			= newImage("/images/hound.gif");
if(document.images){
preloadFlag=true}}
function jsErrorHandler(msg){
alert(msg)}
function sk_popUp(url,width,height){
popUpParams="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+width+", height="+height
skWindow = window.open(url,'skPopUp',popUpParams);
}
function protectEmail(username,hostname,linktext){
if(linktext=='' || linktext==null){
var linktext=username+"@"+hostname}
return "<a style=\"color:#555;\" href="+"mail"+"to:"+username+"@"+hostname+">"+linktext+"</a>"}
function echeck(str){
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if(str.indexOf(at)==-1){
return false}
if(str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
return false}
if(str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
return false}
if(str.indexOf(at,(lat+1))!=-1){
return false}
if(str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
return false}
if(str.indexOf(dot,(lat+2))==-1){
return false}
if(str.indexOf(" ")!=-1){
return false}
return true}
function grabElement(element){
if(return_element=document.getElementById(element)){
return return_element
}else{
return null}}
function checkCompanyForm(){
var errorString=''
company_name=grabElement("company_name")
company_contact=grabElement("company_contact")
company_email=grabElement("company_email")
company_address=grabElement("company_address1")
company_city=grabElement("company_city")
company_zip=grabElement("company_zip")
admin_user=grabElement("admin_user")
admin_pass=grabElement("admin_pass")
if(company_name.length<=0 || company_name.value=='My Company' || company_name.value==null){
errorString=errorString+'* Please enter your company name into the form.'+"\r\n"}
if(company_contact.length<=0 || company_contact.value=='Mr. Contact' || company_contact.value==null){
errorString=errorString+'* Please enter your company contact name into the form.'+"\r\n"}
if(company_email.length<=0 || company_email.value==null || echeck(company_email.value)==false || company_email.value=='My Email'){
errorString=errorString+'* Please enter a valid email address into the form.'+"\r\n"}
if(company_address.length<=0 || company_address.value=='My Address 1' || company_address.value==null){
errorString=errorString+'* Please enter your company address into the form.'+"\r\n"}
if(company_city.length<=0 || company_city.value=='My City' || company_city.value==null){
errorString=errorString+'* Please enter your company city into the form.'+"\r\n"}
if(company_zip.length<=0 || company_zip.value=='My Zip' || company_zip.value==null){
errorString=errorString+'* Please enter your company zip/post code into the form.'+"\r\n"}
if(admin_user.length<=0 || admin_user.value=='Enter' || admin_user.value==null){
errorString=errorString+'* Please choose an administrator username for the site.'+"\r\n"}
if(admin_pass.length<=0 || admin_pass.value=='Enter' || admin_pass.value==null){
errorString=errorString+'* Please choose an administrator password for the site.'+"\r\n"}
if(errorString.length>2){
jsErrorHandler(errorString)
return false
}else{
return true}}
function checkAdminLogin(){
var errorString=''
admin_user=grabElement("admin_user")
admin_pass=grabElement("admin_pass")
if(admin_user.value=='' || admin_user.value==null){
errorString=errorString+'* Please enter the administrator username.'+"\r\n"}
if(admin_pass.value=='' || admin_pass.value==null){
errorString=errorString+'* Please enter the administrator password.'+"\r\n"}
if(errorString.length>2){
jsErrorHandler(errorString)
return false
}else{
return true}}
function sk_changeCSS(elementToChange,changeToClass){
if(elementToChange !=null&&changeToClass !=null){
document.getElementById(elementToChange).className=changeToClass}}
function sk_validateNewsletter(){
var newsletterEmail=grabElement('newsletter_email')
if(newsletterEmail.value==null || newsletterEmail.value==''){
jsErrorHandler("Please enter your e-mail address into the form.")
return false}
if(echeck(newsletterEmail.value)==false){
jsErrorHandler("Please enter a valid e-mail address into the form.")
return false}
return true}
function sk_validateContactForm(){
var contactFormEmail=grabElement('email')
var contactFormFirstName=grabElement('first_name')
var contactFormLastName=grabElement('last_name')
var contactFormComments=grabElement('comments')
var errorString=''
if(contactFormEmail.value==null || contactFormEmail.value==''){
errorString=errorString+"* Please enter your e-mail address into the form."+"\r\n"
}else{
if(echeck(contactFormEmail.value)==false){
errorString=errorString+"* Please enter a valid e-mail address into the form."+"\r\n"}}
if(contactFormFirstName.value==null || contactFormFirstName.value==''){
errorString=errorString+"* Please enter your first name into the form."+"\r\n"}
if(contactFormLastName.value==null || contactFormLastName.value==''){
errorString=errorString+"* Please enter your last name into the form."+"\r\n"}
if(contactFormComments.value==null || contactFormComments.value==''){
errorString=errorString+"* Please enter your comments into the form."+"\r\n"}
if(errorString.length>2){
jsErrorHandler(errorString)
return false
}else{
if(submitButton=grabElement('submit')){
submitButton.value="PROCESSING..."}
return true}}
function sk_checkContactMeForm(){
var contactFormEmail=grabElement('email')
var contactFormFirstName=grabElement('name')
var contactFormZipCode=grabElement('zip_code')
var contactFormEveningPhone=grabElement('eveningphone')
var contactFormSubmit=grabElement('submit')
var errorString=''
if(contactFormEveningPhone.value==null || contactFormEveningPhone.value==''){
if(contactFormEmail.value==null || contactFormEmail.value==''){
errorString=errorString+"* Please enter your e-mail address into the form."+"\r\n"
}else{
if(echeck(contactFormEmail.value)==false){
errorString=errorString+"* Please enter a valid e-mail address into the form."+"\r\n"}}}
if(contactFormEmail.value !=null || contactFormEmail.value !=''){
if(echeck(contactFormEmail.value)==false){
errorString=errorString+"* Please enter a valid e-mail address into the form."+"\r\n"}}
if(contactFormEveningPhone.value !=null || contactFormEveningPhone.value !=''){
errorString=errorString+"* Please enter a valid phone number into the form."+"\r\n"}
if(contactFormFirstName.value==null || contactFormFirstName.value==''){
errorString=errorString+"* Please enter your first name into the form."+"\r\n"}
if(contactFormZipCode.value==null || contactFormZipCode.value==''){
errorString=errorString+"* Please enter your zip code into the form."+contactFormZipCode.value+"\r\n"}
if(errorString.length>2){
jsErrorHandler(errorString)
return false
}else{
contactFormSubmit.value="PLEASE WAIT..."
return true}}
function sk_checkSmallContactMeForm(){
var contactFormEmail=grabElement('email')
var contactFormFirstName=grabElement('name')
var contactFormZipCode=grabElement('zip_code')
var contactFormEveningPhone=grabElement('eveningphone')
var errorString=''
if(contactFormEveningPhone.value==null || contactFormEveningPhone.value==''){
if(contactFormEmail.value==null || contactFormEmail.value==''){
errorString=errorString+"* Please enter your e-mail address into the form."+"\r\n"
}else{
if(echeck(contactFormEmail.value)==false){
errorString=errorString+"* Please enter a valid e-mail address into the form."+"\r\n"}}}
if(contactFormEmail.value !=null || contactFormEmail.value !=''){
if(echeck(contactFormEmail.value)==false){
errorString=errorString+"* Please enter a valid e-mail address into the form."+"\r\n"}}
if(contactFormFirstName.value==null || contactFormFirstName.value==''){
errorString=errorString+"* Please enter your name into the form."+"\r\n"}
if(contactFormZipCode.value==null || contactFormZipCode.value==''){
errorString=errorString+"* Please enter your zip code into the form."+contactFormZipCode.value+"\r\n"}
if(errorString.length>2){
jsErrorHandler(errorString)
return false
}else{
return true}}
function sk_checkServiceAreaForm(){
var errorString=''
var saFormZipCode=grabElement('zip_code')
var saFormCity=grabElement('city')
if((saFormZipCode.value==null || saFormZipCode.value=='')&&(saFormCity.value==null || saFormCity.value=='')){
errorString=errorString+"* Please enter either your zip code or your city into the form."+"\r\n"}
if(errorString.length>2){
jsErrorHandler(errorString)
return false
}else{
document.getElementById('submit').value="..."
return true}}
preloadImages();
var loadedobjects=""
var rootdomain="http://"+window.location.hostname

// Cookie Toolbox Javascript
// copyright 4th September 2002, by Stephen Chapman, Felgall Pty Ltd
// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.
// For instructions on how to use these functions see "A Cookie Toolbox"
// in the Javascript section of our site at http://www.felgall.com/
var dbug = 0; function d_a(ary) {var beg = next_entry(ary) - 1; for (var i = beg ; i > -1; i--) {ary[i] = null;}} function init_array() {if (dbug) alert('init_cookie');  var ary = new Array(null); return ary;} function set_cookie(name,value,expires) {if (dbug) alert('set_cookie:' + value); if (!expires) expires = new Date();
document.cookie = name + '=' + escape(value) + '; expires=' + expires.toGMTString() + '; path=/';} function get_cookie(name) {if (dbug) alert('get_cookie'); var dcookie = document.cookie; var cname = name + "="; var clen = dcookie.length; var cbegin = 0; while (cbegin < clen) {var vbegin = cbegin + cname.length;
if (dcookie.substring(cbegin, vbegin) == cname) {var vend = dcookie.indexOf (";", vbegin); if (vend == -1) vend = clen; return unescape(dcookie.substring(vbegin, vend));} cbegin = dcookie.indexOf(" ", cbegin) + 1; if (cbegin == 0) break;} return null;} function del_cookie(name) {if (dbug) alert('del_cookie');
document.cookie = name + '=' + '; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/';} function get_array(name, ary) {if (dbug) alert('get_array'); d_a(ary); var ent = get_cookie(name); if (ent) {i = 1; while (ent.indexOf('^') != '-1') {ary[i] = ent.substring(0,ent.indexOf('^')); i++;
ent = ent.substring(ent.indexOf('^')+1, ent.length);}}} function set_array(name, ary, expires) {if (dbug) alert('set_array: ' + ary); var value = ''; for (var i = 1; ary[i]; i++) {value += ary[i] + '^';} set_cookie(name, value, expires);} function del_entry(name, ary, pos, expires) {if (dbug) alert('del_entry');
var value = ''; get_array(name, ary); for (var i = 1; i < pos; i++) {value += ary[i] + '^';} for (var j = pos + 1; ary[j]; j++) {value += ary[j] + '^';} set_cookie(name, value, expires);} function next_entry(ary) {if (dbug) alert('next_entry'); var j = 0; for (var i = 1; ary[i]; i++) {j = i} return j + 1;}
function debug_on() {dbug = 1;} function debug_off() {dbug = 0;} function dump_cookies() {if (document.cookie == '') document.write('No Cookies Found'); else {thisCookie = document.cookie.split('; '); for (i=0; i<thisCookie.length; i++) {document.write(thisCookie[i] + '<br \/>');}}}

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Robert Nyman | http://robertnyman.com/ */
function removeHTMLTags(inCode){
 		var strInputCode = inCode;
 		/* 
  			This line is optional, it replaces escaped brackets with real ones, 
  			i.e. < is replaced with < and > is replaced with >
 		*/	
 	 	strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
 		 	return (p1 == "lt")? "<" : ">";
 		});
 		var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
 		return strTagStrippedText;
}

function explode( delimiter, string, limit ) {
 
    var emptyArray = { 0: '' };
    
    // third argument is not required
    if ( arguments.length < 2 ||
        typeof arguments[0] == 'undefined' ||
        typeof arguments[1] == 'undefined' )
    {
        return null;
    }
 
    if ( delimiter === '' ||
        delimiter === false ||
        delimiter === null )
    {
        return false;
    }
 
    if ( typeof delimiter == 'function' ||
        typeof delimiter == 'object' ||
        typeof string == 'function' ||
        typeof string == 'object' )
    {
        return emptyArray;
    }
 
    if ( delimiter === true ) {
        delimiter = '1';
    }
    
    if (!limit) {
        return string.toString().split(delimiter.toString());
    } else {
        // support for limit argument
        var splitted = string.toString().split(delimiter.toString());
        var partA = splitted.splice(0, limit - 1);
        var partB = splitted.join(delimiter.toString());
        partA.push(partB);
        return partA;
    }
}

function skValidateEmail(sVal) {var regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;if (regex.test(sVal)){return true;}else{return false;}}
function getElementsByClassName(classname, node) {if(!node) node = document.getElementsByTagName("body")[0];var a=[];var re=new RegExp('\\b' + classname + '\\b');var els=node.getElementsByTagName("*");for(var i=0,j=els.length; i<j; i++){if(re.test(els[i].className))a.push(els[i]);}return a;}
function skEncode(input){var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4) | (chr2>>4);enc3=((chr2&15)<<2) | (chr3>>6);enc4=chr3&63;
      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }
      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
   
   return output;
}

var toTimeStamp = new Date().getTime();

function skDoLoginRequest(url){
	$.ajax({
		type: "GET",
		dataType: "text",
		url: url,
		success: function(data, textStatus) {
			var response=data+'';
			if (response=="Y"){
				skProcessUserLogin();
			} else if (response=="I"){
				alert("The username / password combination you have entered is not correct.");
			} else {
				alert("You could not be logged in with the information provided.");
			}		
		}
	});
}
function skProcessUserLogin() {
	if (userName = document.getElementById("vfusername2")) {
		userName.value = trim(userName.value);
		var u = userName.value;
		if (passWord = document.getElementById("vfpassword2")) {		
			passWord.value = trim(passWord.value);
			var p = passWord.value;
			if (storeLogin = document.getElementById("vfremember")) {
				if (storeLogin.checked==true) {
					var r = "Y";			
				} else {
					var r = "N";						
				}
				var paramsToSend = skEncode(u + "|" + p + "|" + r);
				window.location.href = "http://www.vaporfox.com/index.php/action/vapers/li/" + paramsToSend;
				return false;
			}
		}
	}
	alert("Login Error, please try again.");
	return false;
}
function showLoadingMsg(id,msg){document.getElementById(id).innerHTML='<' + 'div align="center" style="font-size:10pt;font-weight:bold;">' + '<' + 'img src="/images/hound.gif" width="32" height="32" border="0" alt="Loading" align="middle" /> &nbsp;&nbsp;' + msg + '<' + '/div>';}

function vpSearch(page,sort) {
	var advancedSearchString = "";
	var c_value="";
	if (!page) {
		page = "1";	
	}
	if (!sort) {
		sort = skEncode("product_name");
	}
	var timestamp = new Date().getTime();
	if (searchContainer = parent.document.getElementById("stock_updates")) {

		searchTerm = parent.document.getElementById("keyword");
		advSearchTerm = parent.document.getElementById("adv_keyword");		
	
		if (maxPrice = parent.document.getElementById("maxprice")) {
			if (maxPrice.value>0) {
				advancedSearchString = advancedSearchString + "/mp/" + maxPrice.value;
				searchTerm = advSearchTerm;
			}
		}
		if (maxPrice = parent.document.getElementById("cselector_placeholder")) {
			for (var i=0; i < document.forms["vp_adv_search"].limitcountry.length; i++) {
				if (document.forms["vp_adv_search"].limitcountry[i].checked) {
					if (document.forms["vp_adv_search"].limitcountry[i].value>0) {
						c_value = c_value + document.forms["vp_adv_search"].limitcountry[i].value + "|";
						searchTerm = advSearchTerm;
					}
				}
			}
			if (c_value!="") {
				advancedSearchString = advancedSearchString + "/cl/" + c_value;
				searchTerm = advSearchTerm;
			}
		}
		if (exactMatch = parent.document.getElementById("exactmatchwords")) {
			if (exactMatch.checked) {
				advancedSearchString = advancedSearchString + "/em/Y";
				searchTerm = advSearchTerm;
			}
		}
		if (onlyInStock = parent.document.getElementById("onlyinstock")) {
			if (onlyInStock.checked==true) {
				oIS = "Y";				
			} else {
				oIS = "N";								
			}
			if (searchTerm.value!='') {
				var id = "stock_updates";
				var msg = "Searching VaporFox...";
				var url = "http://www.vaporfox.com/index.php/action/search/t/" + skEncode(searchTerm.value) + "/p/" + page + "/x/" + sort + "/ois/" + oIS + "/s/" + timestamp + advancedSearchString;
				$('html, body').animate({scrollTop: $("#stock_updates").offset().top},800);
				showLoadingMsg(id,msg);
				$("#"+id).load(url);
				//ajaxpage(url,id);
			} else {
				alert("Please enter a search term into the form.");			
			}
		}
	}
	return false;
}

function vfShowOtherSearchBox() {$("#basic_search_box").toggle();$("#advanced_search_box").toggle();}
function vfLogin() {alert("Accounts have not yet been activated.");return false;}

function vfLoginAdvanced() {
	if (box = document.getElementById("login_message_container")) {
		if (userName = document.getElementById("vfusername2")) {
			userName.value = trim(userName.value);
			if (userName.value=="" || userName.length<5) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;Please enter your username into the form.</div>';
				userName.focus();
				if (to) clearTimeout(to);
				var to = setTimeout("vfClearLoginError()",10000);
				return false;
			}		
		} else {
			return false;		
		}
		if (passWord = document.getElementById("vfpassword2")) {
			passWord.value = trim(passWord.value);
			if (passWord.value=="" || passWord.length<5) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;Please enter your password into the form.</div>';
				passWord.focus();
				if (to) clearTimeout(to);
				var to = setTimeout("vfClearLoginError()",10000);
				return false;
			}		
		} else {
			return false;		
		}
		if (storeLogin = document.getElementById("vfremember")) {
			if (storeLogin.checked==true) {
				var rememberLogin = "Y";			
			} else {
				var rememberLogin = "N";						
			}
		} else {
			return false;		
		}
		url = "http://www.vaporfox.com/index.php/action/vapers/process/login/u/" + skEncode(userName.value) + "/p/" + skEncode(passWord.value) + "/r/" + rememberLogin;
		skDoLoginRequest(url);
	}
	return false;
}
function vfCreateUser() {
	if (box = document.getElementById("signup_message_container")) {
		if (userName = document.getElementById("vfusername3")) {
			userName.value = trim(userName.value);
			if (userName.value=="" || userName.length<5) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;Please enter a username into the form.</div>';
				userName.focus();
				var to = setTimeout("vfClearSignupError()",10000);
				return false;
			}		
		}
		if (passWord = document.getElementById("vfpassword3")) {
			passWord.value = trim(passWord.value);
			if (passWord.value=="" || passWord.length<5) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;Please enter a password into the form.</div>';
				passWord.focus();
				var to = setTimeout("vfClearSignupError()",10000);
				return false;
			}		
		}
		if (passWordConfirm = document.getElementById("vfconfirmpass")) {
			passWordConfirm.value = trim(passWordConfirm.value);
			if (passWordConfirm.value=="" || passWordConfirm.length<5) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;Please confirm your password.</div>';
				passWordConfirm.focus();
				var to = setTimeout("vfClearSignupError()",10000);
				return false;
			}		
		}
		if (passWord.value != passWordConfirm.value) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;The passwords you have entered do not match.</div>';
				passWord.focus();
				var to = setTimeout("vfClearSignupError()",10000);
				return false;
		}
		if (emailAddress = document.getElementById("vfemailaddress")) {
			emailAddress.value = trim(emailAddress.value);
			if (emailAddress.value=="" || emailAddress.length<5) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;Please enter your e-mail address into the form.</div>';
				emailAddress.focus();
				var to = setTimeout("vfClearSignupError()",10000);
				return false;
			}
			if (!skValidateEmail(emailAddress.value)) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;Please enter a valid e-mail address into the form.</div>';
				emailAddress.focus();
				var to = setTimeout("vfClearSignupError()",10000);
				return false;
			}
		}
		if (emailAddressVerify = document.getElementById("vfemailaddressconfirm")) {
			emailAddressVerify.value = trim(emailAddressVerify.value);
			if (emailAddressVerify.value=="" || emailAddressVerify.length<5) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;Please verify your e-mail address in the form.</div>';
				emailAddressVerify.focus();
				var to = setTimeout("vfClearSignupError()",10000);
				return false;
			}
			if (emailAddressVerify.value != emailAddress.value) {
				box.innerHTML = '<div class="error"><img src="/images/icons/famfam/error.png"/>&nbsp;&nbsp;The e-mail addresses you have entered do not match.</div>';
				emailAddress.focus();
				var to = setTimeout("vfClearSignupError()",10000);
				return false;
			}
		}
		var id = "signup_message_container";
		var msg = "Processing Account...";
		var url = "http://www.vaporfox.com/index.php/action/vapers/process/adduser/u/" + skEncode(userName.value) + "/p/" + skEncode(passWord.value) + "/e/" + skEncode(emailAddress.value);
		showLoadingMsg(id,msg);
		$("#"+id).load(url);
		//ajaxpage(url,id);
		var to = setTimeout("vfClearUserCreation()",7000);
	}
	return false;
}

function vfClearSignupError(){if (box=document.getElementById("signup_message_container")){box.innerHTML="";}}
function vfClearLoginError(){if (box=document.getElementById("login_message_container")){box.innerHTML="";}}
function vfClearUserCreation(){if (box=document.getElementById("signup_area")){box.innerHTML = "<div style=\"font-size:8pt;padding:5px;font-weight:bold;color:blue;\">Thanks!  Please check your e-mail for the activation message and then use the form above to log in.<br/><br/>Please make sure that your SPAM filters do not trap your activation e-mail.</div>";}}

function vfSuggest() {
	var timestamp = new Date().getTime();
	if (searchContainer = document.getElementById("suggest_result")) {
		if (searchTerm = document.getElementById("siteurl")) {
			if (searchTerm.value != '' && searchTerm.value != 'http://') {
				var id = "suggest_result";
				var msg = "Sending Out The Hound...";
				var url = "http://www.vaporfox.com/index.php/action/search/verify/" + skEncode(searchTerm.value) + "/s/" + timestamp;
				showLoadingMsg(id,msg);
				//ajaxpage(url,id);
				$("#"+id).load(url);
			} else {
				alert("Please enter a web site URL into the form.");			
			}
		}
	}
	return false;
}
function vfGetLoi() {
	var timestamp = new Date().getTime();
	if (searchContainer = document.getElementById("loi_result")) {
		if (searchTerm = document.getElementById("site_id")) {
			if (searchTerm.value!='') {
				var id = "loi_result";
				var msg = "Sending Out The Hound...";
				var url = "http://www.vaporfox.com/index.php/action/vaporfox_admin/process/single_loi_doit/siteid/" + skEncode(searchTerm.value) + "/s/" + timestamp;
				showLoadingMsg(id,msg);
				//ajaxpage(url,id);
				$("#"+id).load(url);
			} else {
				alert("Please enter a search term into the form.");			
			}
		}
	}
	return false;
}
function vfChangeCurrencySymbol(symbol){
	if (symbolPlace = document.getElementById("currency_maxprice")) {
		symbolPlace.innerHTML = symbol;
	}
}
function vfGetSingleURL() {
	if (parsedURL = document.getElementById("url_to_parse")) {
		if (parsedURL.value!='') {
			var spit = "N";
			if (verbose = document.getElementById("spit")) {
				if (verbose.checked) {
					var spit = "Y";
				}
			}
			var id = "loi_result";
			var msg = "Sending Out The Hound...";
			var timestamp = new Date().getTime();
			var url="http://www.vaporfox.com/index.php/action/vaporfox_admin/process/single_url_doit/s/" + timestamp +"/spit/" + spit + "?url=" + skEncode(parsedURL.value);
			showLoadingMsg(id,msg);
			//ajaxpage(url,id);
			$("#"+id).load(url);
		} else {
			alert("Please enter a URL into the form.");
		}
	}
	return false;
}
function vfAddFavStore(storeID,divID) {
	url = "http://www.vaporfox.com/index.php/action/vapers/process/add_favorite_store/store_id/" + storeID + "/divID/" + divID;
	new Ajax.Request(url,{method:'get',onSuccess:processFavoriteStoreAdd,onFailure:function(){alert("There was an error with the connection");}});
}
function processFavoriteStoreAdd(transport) {
	var response=transport.responseText+'';
	responseArray = explode("||",response);
	if (responseArray[0]=="Y"){
		if (changeHeart = document.getElementById(responseArray[1])) {
			changeHeart.innerHTML = '<img src="/images/icons/famfam/heart.png" border="0" alt="Favorite Store" width="16" height="16" />';
		}
		alert("Store Added To Favorites");
	} else if (responseArray[0]=="N"){
		alert("The Store Could Not Be Added To Your Favorites.");
	} else if (responseArray[0]=="E"){
		alert("The Store Is Already One Of Your Favorites.");
	} else {
		alert("An Error Has Occurred, Please Try Again.");
	}
} 
function processOpenIdLogin(transport) {
	var response=transport.responseText+'';
	if (responseContainer = document.getElementById("vaporfox_openID_response")) {
		responseContainer.innerHTML = response;
	}
	return false;
}

function vfOpenIDLogin() {
	if (openID = document.getElementById("openid_identifier")) {
		url = "http://www.vaporfox.com/includes/modules/openID/oid.php?openid_identifier=" + openID.value;
		$('#vaporfox_openID_response').load(url);
	}
	return false;
}

function submitRating(form) {
	var errorMsg = "";
	var skParams = "action=add_review&aj=1";
	if (reviewerID = document.getElementById("review_user_id")) {
		skParams = skParams + "&review_user_id=" + reviewerID.value;
	}
	if (productID = document.getElementById("product_id")) {
		skParams = skParams + "&product_id=" + productID.value;
	}
	skParams = skParams + "&review_stars=" + form.review_stars.value;

	if (reviewerName = document.getElementById("reviewer_name")) {
		if (reviewerName.value=="") {
			errorMsg = errorMsg + "Please enter your name into the form." + "\r\n";
		} else {
			skParams = skParams + "&reviewer_name=" + form.reviewer_name.value;
		}
	}
	if (reviewerTitle = document.getElementById("review_title")) {
		if (reviewerTitle.value=="") {
			if (form.review_title.value == "") {
				errorMsg = errorMsg + "Please enter a title for your new review into the form." + "\r\n";
			} else {
				skParams = skParams + "&review_title=" + form.review_title.value;			
			}
		} else {
			skParams = skParams + "&review_title=" + reviewerTitle.value;
		}
	}
	if (reviewerTexts = document.getElementById("review_details")) {
		if (reviewerTexts.value=="") {
			if (form.review_details.value=="") {
				errorMsg = errorMsg + "Please enter your review into the form." + "\r\n";
			} else {
				skParams = skParams + "&review_details=" + form.review_details.value;
			}
		} else {
			skParams = skParams + "&review_details=" + reviewerTexts.value;
		}
	}
	if (errorMsg.length>5) {
		alert(errorMsg);
	} else {
		$.post("/index.php", skParams,
			function(data){
				if (data=="SUCCESS") {
					alert("THANK YOU!");
					getReviewsForProduct();
				} else {
					alert(data);
				}	
			}
		);
	}
	return false;
}


$(document).ready(function() {
	if (socialArea=document.getElementById("twitter_sidebar")) {
		$('.sn_icon').mouseover(function(){$(this).animate({opacity: "0.5"},75);}).mouseout(function(){$(this).animate({opacity: "1.0"});});
	}
	$(function() { $(".lavaLamp").lavaLamp({ fx: "backout", speed: 700 })});
});
