/* Knowledgebase popups */
function help_popup(){
	location.href='http://help.vodafone.co.nz/app/home/';
	return false;
}
function kbgeneric_popup(url){ /* You can pass this one a specific URL */
	location.href=url;
	return false;
}

/* Original function
function kbitem_popup(id){
	location.href='http://vodafonenz.custhelp.com/cgi-bin/vodafonenz.cfg/php/enduser/std_adp.php?p_faqid=' + id + '';
}*/

// Modified function to handle shop and knox pages which require KB articles to be displayed in a popup
function kbitem_popup(id){ /* You can pass in a KB item ID to display specific answer */		
	// get the current URL
	var current_url = document.URL;
	// and check if we're on a knox or shop page
	if ((current_url.indexOf("shop")!=-1) || (current_url.indexOf("knox")!=-1)){	
		popup = "kbitem = window.open('http://help.vodafone.co.nz/app/answers/detail/a_id/" + id + "','help','width=840,height=650,scrollbars=1,toolbar=1,resizeable=1');";
		popup = eval(popup);
		kbitem.focus();
	} else {
		location.href='http://help.vodafone.co.nz/app/answers/detail/a_id/' + id + '';
	}
	return false;
}

function kbsearch_popup(searchterm){ /* Passes in a search keyword */
	location.href='http://help.vodafone.co.nz/app/topics/kw/' + searchterm;
	return false;
}

function kbgames_popup(searchterm){ /* Specific for searching about games in the KB */
	location.href='http://vodafonenz.custhelp.com/cgi-bin/vodafonenz.cfg/php/enduser/std_alp.php?p_sid=wKiz1sSh&p_lva=&p_li=&p_page=1&p_cv=2.722&p_pv=&p_prods=&p_cats=651%2C722&p_hidden_prods=&cat_lvl1=651&cat_lvl2=722&p_search_text=' + searchterm + '&x=0&y=0&p_new_search=1';
	return false;
}

function contact_popup(){ /* Launches the contact page */
	location.href='http://help.vodafone.co.nz/app/ask';
	return false;
}

function myhelp_popup(){ /* Launches My Help section of KB */
	location.href='http://vodafonenz.custhelp.com/cgi-bin/vodafonenz.cfg/php/enduser/myq_ilp.php';
	return false;
}