var rootdomain="http://"+window.location.hostname;
var sLocationURL = "/mobile/";
var baseLocation //'../'; //'/edl';

function dropMenuNavigation() {
	var menuItem = document.frmBrowser.drpNavigate.value;	//document.frmBrowser.drpNavigate(document.frmBrowser.drpNavigate.selectedIndex).value;
	document.location = menuItem;
}

function loadMenu() {/*
	var pageLocation, splitString, splitSubString, subString, i;
	pageLocation = location;
	myString = new String(pageLocation);
	splitString = myString.split("/");
	switch(splitString[4])
	{
		case "ringtones" : 
			document.getElementById('browseMobileContent').className = 'showView';
			document.getElementById('browseMobileTones').className = 'showView';
			document.getElementById('menubrowseMobileTones').className = 'selectedTab';
			switch(splitString[5])
			{
				case "" :
					document.getElementById('browseMobileTonesHome').className = 'selectedPage';
				break;
				case "polyphonics" : 
					document.getElementById('browseMobileTonesPOLY').className = 'selectedPage';
				break;
				case "monophonics" : 
					document.getElementById('browseMobileTonesMONO').className = 'selectedPage';
				break;
				case "real_tones" : 
					document.getElementById('browseMobileTonesSING').className = 'selectedPage';
				break;
				case "sfx_tones" : 
					document.getElementById('browseMobileTonesSFXT').className = 'selectedPage';
				break;
				case "talking_tones" : 
					document.getElementById('browseMobileTonesTALK').className = 'selectedPage';
				break;
				default : 
					splitSubString = splitString[5].split("=");
					splitSubString = splitSubString[1].split("&");
					document.getElementById('browseMobileTones' + splitSubString[0]).className = 'selectedPage';
			}
		break; 
		case "graphics" :
			document.getElementById('browseMobileContent').className = 'showView';
			document.getElementById('browseMobileGraphics').className = 'showView';
			document.getElementById('menubrowseMobileGraphics').className = 'selectedTab';
			switch(splitString[5])
			{
				case "" :
				document.getElementById('browseMobileGraphicsHome').className = 'selectedPage';
				break;
				case "wallpapers" :
					document.getElementById('browseMobileGraphicsCELEB').className = 'selectedPage';
				break;
				case "animations" :
					document.getElementById('browseMobileGraphicsCANIM').className = 'selectedPage';
				break;
				case "picture_messages" :
					document.getElementById('browseMobileGraphicsPICM').className = 'selectedPage';
				break;
				case "colour_logos" :
					document.getElementById('browseMobileGraphicsLOGO').className = 'selectedPage';
					break;
				case "themed_skins" :
					document.getElementById('browseMobileGraphicsSKIN').className = 'selectedPage';
				break;
				case "backgrounds" :
					document.getElementById('browseMobileGraphicsBACKGROUND').className = 'selectedPage';
				break;
				case "slideshows" : 
					document.getElementById('browseMobileGraphicsSLIDESHOW').className = 'selectedPage';
				break;
				case "cartoons" : 
					document.getElementById('browseMobileGraphicsCARTOON').className = 'selectedPage';
				break;
				default : 
					splitSubString = splitString[5].split("=");
					splitSubString = splitSubString[1].split("&");
					document.getElementById('browseMobileGraphics' + splitSubString[0]).className = 'selectedPage';
			}
		break;
		case "games" :
			document.getElementById('browseMobileContent').className = 'showView';
			document.getElementById('browseMobileGames').className = 'showView';
			document.getElementById('menubrowseMobileGames').className = 'selectedTab';
			switch(splitString[5])
			{
				case "" :
					document.getElementById('browseMobileGamesHome').className = 'selectedPage';
				break;
				default : 
					i = splitString[5].indexOf("=");
					switch(i)
					{
					case 4 : //?cat =
						splitSubString = splitString[5].split("=");
						splitSubString = splitSubString[1].split("&");
						document.getElementById('browseMobileGames' + splitSubString[0]).className = 'selectedPage';
					break;
					case 16 : //default.aspx?cat=
						splitSubString = splitString[5].split("=");
						if(splitSubString[0] == "default.aspx?cat") {
						splitSubString = splitSubString[1].split("&");
						document.getElementById('browseMobileGames' + splitSubString[0]).className = 'selectedPage';
						}else{
						
						}
					break;
					default : //404
						j = splitString.length
						switch(j)
						{
						case 7 : //404 product.aspx
							if(splitString[5] == 'Movie+') {
								document.getElementById('browseMobileGamesMOVIE+%2f+TV').className ='selectedPage';
							}else{
							
							}
							if(splitString[5] == 'Console+') {
								document.getElementById('browseMobileGamesCONSOLE+%2f+ARCADE').className = 'selectedPage';
							}else{
							
							}
						break;
						case 6 :  //404 Category
						document.getElementById('browseMobileGames' + splitString[5]).className = 'selectedPage';
						break;
						default :
						}						
					}
			}
		break;
		case "video" :
			document.getElementById('browseMobileContent').className = 'showView';
			document.getElementById('browseMobileVideos').className = 'showView';
			document.getElementById('menubrowseMobileVideos').className = 'selectedTab';
			switch(splitString[5])
			{
				case "" :
					document.getElementById('browseMobileVideosHome').className = 'selectedPage';
				break;
				default : 
					i = splitString[5].indexOf("=");
					switch(i)
					{
					case 4 : //?cat=
						splitSubString = splitString[5].split("=");
						document.getElementById('browseMobileVideos' + splitSubString[1]).className = 'selectedPage';
					break;
					case 16 : //default.aspx?cat=
						splitSubString = splitString[5].split("=");
						splitSubString = splitSubString[1].split("&");
						document.getElementById('browseMobileVideos' + splitSubString[0]).className = 'selectedPage';
					break;
					default :
						document.getElementById('browseMobileVideos' + splitString[5]).className = 'selectedPage';
					}
			}
	}*/
}

function redirectHome() { document.window.location.href = "/browse/default.aspx"; }	

function buy(pid) {
	document.getElementById('paymentOptions').className = 'showView';
	basketFrame.location = "/basket/update.aspx?pid=" + pid;
}	
	
function showBrowseArtists() {
	document.getElementById('Right1_navBrowseArtists').className = 'showView';
	document.getElementById('Right1_navBrowseTracks').className = 'hideView';
	document.getElementById('Right1_navBrowseGenres').className = 'hideView';
	document.getElementById('Right1_navBrowseAlbums').className = 'hideView';
	return false;
}

function showBrowseAlbums() {
	document.getElementById('Right1_navBrowseArtists').className = 'hideView';
	document.getElementById('Right1_navBrowseTracks').className = 'hideView';
	document.getElementById('Right1_navBrowseGenres').className = 'hideView';
	document.getElementById('Right1_navBrowseAlbums').className = 'showView';
	return false;
}


function showBrowseTrack() {
	document.getElementById('Right1_navBrowseArtists').className = 'hideView';
	document.getElementById('Right1_navBrowseTracks').className = 'showView';
	document.getElementById('Right1_navBrowseGenres').className = 'hideView';
	document.getElementById('Right1_navBrowseAlbums').className = 'hideView';
	return false;
}

function showBrowseGenres() {
	document.getElementById('Right1_navBrowseGenres').className = 'showView';
	document.getElementById('Right1_navBrowseArtists').className = 'hideView';
	document.getElementById('Right1_navBrowseTracks').className = 'hideView';
	document.getElementById('Right1_navBrowseAlbums').className = 'hideView';
	return false;
}

/*function menuBrowseOver() {
	document.getElementById('browseContent').className = 'showView';
}
function menuBrowseOut() {
	document.getElementById('browseContent').className = 'hideView';
}*/

function menuBrowseJava() { document.getElementById('browseContent').className = 'hideView'; }

function select_deselectAll (chkVal, idVal) { 
    var frm = document.forms[0];
    // Loop through all elements
    for (i=0; i<frm.length; i++) {
        // Look for our Header Template's Checkbox
        if (idVal.indexOf ('CheckAll') != -1) {
            // Check if main checkbox is checked, then select or deselect datagrid checkboxes 
            if(chkVal == true) { frm.elements[i].checked = true; } 
            else { frm.elements[i].checked = false; }
            // Work here with the Item Template's multiple checkboxes
        } 
        else if (idVal.indexOf ('DeleteThis') != -1) {
            // Check if any of the checkboxes are not checked, and then uncheck top select all checkbox
            if(frm.elements[i].checked == false) { frm.elements[1].checked = false; } //Uncheck main select all checkbox
        }
    }
}

function addtoBasket(title, type, pid, country, points) { //add to basket on left side
	newtitle = escape(title);
	newtitle = newtitle.replace(/\//g,"%2F");
	newtitle = newtitle.replace(/\?/g,"%3F");
	newtitle = newtitle.replace(/=/g,"%3D");
	newtitle = newtitle.replace(/&/g,"%26");
	newtitle = newtitle.replace(/@/g,"%40");
		
	basketFrame.location = sLocationURL + "basket/update.aspx?task=add&title=" + newtitle + "&type=" + type + "&pid=" + pid + "&country=" + country + "&points=" + points;
}

function checkout(title, type, pid) { basketFrame.location = "../basket/update.aspx?task=checkout&title=" + title + "&type=" + type + "&pid=" + pid; }
function checkout1(title, type, pid, country) { basketFrame.location = sLocationURL + "basket/update.aspx?task=checkout&title=" + title + "&type=" + type + "&pid=" + pid + "&country=" + country; }
function deletefromBasket(type, pid) { parent.basketFrame.location = sLocationURL + "basket/update.aspx?task=delete&type=" + type + "&pid=" + pid; }
function deletefromBasketChOut(type, pid) { basketFrame.location = sLocationURL + "basket/update.aspx?task=deletech&type=" + type + "&pid=" + pid; }
function deleteallfromBasket() { basketFrame.location = sLocationURL + "basket/update.aspx?task=delall"; }

function updateShoppingBasket() {	
	//var parent_url = null;
	//parent_url=new String(window.parent.location);
	//parent.window.location = "/mobile/default.aspx?redirpg="+parent_url; //new code for redirect

	//parent.ifrBask.location.href = "/mobile/basket/baskdispfr.aspx";
	//parent.ifrBask.location.reload();
	refreshBask();
}

function updateShoppingBasketCh() {	
	var parent_url = null;
	parent_url=new String(window.parent.location);
	parent.window.location = sLocationURL + "redir.aspx?redirpg="+parent_url; //new code for redirect
}

function checkoutShoppingBasket() { parent.window.location = sLocationURL + "basket/checkout.aspx" }
function refreshShoppingCart() { basketFrame.location = baseLocation + "/basket/update.aspx"; }
function addtoMobileCart(PID, title, points, type) {
	document.basketFrame.location.href = baseLocation + "/basket/update.aspx?PID=" + PID + "&Title=" + title + "&Points=" + points + "&type=" + type;
}
function deletefromMobileCart(PID) { document.basketFrame.location.href = baseLocation + "/basket/update.aspx?deletePID=" + PID; }

function redownload(transID, serverID, lmID, wmencpID, uotID) {
	var serverID;
	redownloadFrame.location = baseLocation + "/basket/update.aspx?redownload=1&serverID=" + serverID + "&lmID=" + lmID + "&wmencpID=" + wmencpID + "&uotID=" + uotID + "&transID=" + transID;
}

function redownloadAlbum(albumID, transID, serverID, lmID, wmencpID, uotID) {
	var serverID;
	redownloadFrame.location = baseLocation + "/basket/update.aspx?redownload=1&albumID=" + albumID + "&serverID=" + serverID + "&lmID=" + lmID + "&wmencpID=" + wmencpID + "&uotID=" + uotID + "&transID=" + transID;
}

function download(transactionID, lmID) { downloadFrame.location = baseLocation + "/basket/update.aspx?purchase=1&transID=" + transactionID + "&lmID=" + lmID; }
function addbookmark() {
	bookmarkurl="http://www.partymob.com"
	bookmarktitle="Partymob.com"
	if (document.all)
	window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function showSiteMapAnimations() {
	document.getElementById('MobileGraphicsAnimations').className = 'showView';
	document.getElementById('MobileGraphicsPictureMessages').className = 'hideView';
	document.getElementById('MobileGraphicsLogos').className = 'hideView';
	document.getElementById('MobileGraphicsColourPhotos').className = 'hideView';
}

function showSiteMapLogos() {
	document.getElementById('MobileGraphicsAnimations').className = 'hideView';
	document.getElementById('MobileGraphicsPictureMessages').className = 'hideView';
	document.getElementById('MobileGraphicsLogos').className = 'showView';
	document.getElementById('MobileGraphicsColourPhotos').className = 'hideView';
}

function showSiteMapColourPhotos() {
	document.getElementById('MobileGraphicsAnimations').className = 'hideView';
	document.getElementById('MobileGraphicsPictureMessages').className = 'hideView';
	document.getElementById('MobileGraphicsLogos').className = 'hideView';
	document.getElementById('MobileGraphicsColourPhotos').className = 'showView';
}

function showSiteMapPictureMessages() {
	document.getElementById('MobileGraphicsAnimations').className = 'hideView';
	document.getElementById('MobileGraphicsPictureMessages').className = 'showView';
	document.getElementById('MobileGraphicsLogos').className = 'hideView';
	document.getElementById('MobileGraphicsColourPhotos').className = 'hideView';
}

function okBuy() {
	if (confirm('Are you sure you want to use your plus points to buy this product')) { }
	else { history.go(-1); }
}

/*
function getPhoneModels(strMake){
// updates model list
var models = new Array(<%=CommonMakeModelArrayList%>);

	document.reg_form.model.options.length = 0;
	var looper = 0;
	
	for(var i = 0; i < models.length; i++){
		
		if(models[i].substr(0,3) == strMake){

		getCurrent = document.reg_form.model.value;

		document.reg_form.model.options.length = document.reg_form.model.options.length + 1;
		document.reg_form.model.options[looper].text = models[i];
		document.reg_form.model.options[looper].value = models[i];
		looper++;
		}
	}
}*/

function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1) { 
			c_start=c_start + c_name.length+1 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return null
}

function setCookie(c_name,value,expiredays) {
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate)+
	";path=/"

	var parent_url = null;
	parent_url=new String(window.parent.location);
	parent.window.location = parent_url;
}
function eraseCookie(name) { createCookie(name,"",-1); }

function createCookie(name,value,value2,days) { //name=cookie name, value=mobile no, value2=county code, days=days for expiry
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	
	if (value2.substring(0,1) == "0") { value2 = value2.substring(1,value2.length); }
	if (value2.substring(0,1) == "+") { value2 = value2.substring(1,value2.length); }
	
	var countrycode = null;
	countrycode = new String(value);
	var temparr = new Array();
	temparr = countrycode.split('-');
	
	countrycode = temparr[0];
	if (value2.substring(0,countrycode.length) == countrycode) {
		value2 = value2.substring(countrycode.length,value2.length);
		if (value2.substring(0,1) == "0") { value2 = value2.substring(1,value2.length); }
	}
	
	document.cookie = name+"="+value+"-"+value2+expires+"; path=/";
	
	var parent_url = null;
	parent_url=new String(window.parent.location);
	parent.window.location = sLocationURL + "default.aspx?redirpg="+parent_url; //new code for redirect
	
	//var parent_url = null;
	//parent_url=new String(window.parent.location);
	//parent.window.location = parent_url;
	//parent.window.location.reload(true);
}

function ToggleMenu(oObj) {
	if ( oObj.style.display == "none" ) { oObj.style.display = ""; }
	else { oObj.style.display = "none"; }
	//document.getElementById(oObj).className = 'showView';
}

function ToggleMenuNew(oObj) {
	//if ( oObj.style.display == "none" ) { oObj.style.display = ""; }
	//else { oObj.style.display = "none"; }
	document.getElementById(oObj).className = 'showView';
}

function CheckMobileNo() { //(checkddl, checkmobno)
	var checkddl = "";
	var checkmobno = "";
	checkddl = document.selcountry.code.options[document.selcountry.code.selectedIndex].value;
	checkmobno = document.selcountry.mobileno.value;
	
	if ((checkddl.substring(0,1) != "") && (checkmobno.substring(0,1) != "")) {
		//check through checkmobno for valid number
		var numcheck = checkmobno * 1;
		if (numcheck > 0) { createCookie('partymobcookie', checkddl, checkmobno, 60); }		//alert(numcheck);
		else { alert('Please Re-enter Your Mobile Number\nLeaving out any Spaces or Brackets\ne.g. 07999888888'); }
	}
	else if (checkddl.substring(0,1) == "") { alert('Please Select Your Mobile Country Code'); }
	else if (checkmobno.substring(0,1) == "") { alert('Please Enter Your Mobile Number'); }
}

function resizeIframe(iframeid) {
	var IframeObj = document.getElementById(iframeid);
	if(document.getElementById && !(document.all)) { IframeObj.height = document.getElementById(iframeid).contentDocument.body.scrollHeight; }
	else if(document.all) { IframeObj.height = document.frames(iframeid).document.body.scrollHeight; }
}


/***********************************************
* Ajax Includes script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//To include a page, invoke ajaxinclude("afile.htm") in the BODY of page
//Included file MUST be from the same domain as the page displaying it.

var rootdomain="http://"+window.location.hostname

function ajaxinclude(url, divid) {
var page_request = false

try {
    page_request = new ActiveXObject('Microsoft.XMLHTTP');	// For Internet Explorer.
}
catch(e) {
    try {
		page_request = new XMLHttpRequest();	// Gecko-based browsers, Safari, and Opera.
    }
    catch (e) {
		return false;	// Browser supports Javascript but not XMLHttpRequest.
    }
}

/*if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false*/
page_request.open('GET', url, false) //get page synchronously 
page_request.send(false) //null)
writecontent(page_request, divid)
}

function writecontent(page_request, divid) {
	if (window.location.href.indexOf("http")==-1 || page_request.status==200)
		writit(page_request.responseText, divid)	//document.write(page_request.responseText)
}

function refreshBask() {
	ajaxinclude(rootdomain+sLocationURL + "basket/baskdispfr.aspx", 'divBaskNew');
}

function refreshLocDiv() {
	ajaxinclude(rootdomain+sLocationURL + "layout/locframe.aspx?id=text", 'divLocDisp');
}

function writit(text, divid) {
	if (document.getElementById) {
		var x = parent.document.getElementById(divid);
		//x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all) {
		var x = parent.document.all[divid];
		//x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.layers) {
		var x = parent.document.layers[divid];
		x.document.open();
		x.document.write(text);
		x.document.close();
	}
}

function showPreviewDiv(toneName, PID, toneType, obj) {
	//var coors = findPos(obj);
	ajaxinclude(rootdomain+sLocationURL + "tonepreview.aspx?pid="+PID+"&cat="+toneType, 'divTonePrev');
	writit(toneName, 'divTonename');
	//show div
	MM_showHideLayers('prevLaydiv','','show','300','300');
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj_old(n, d) { //v3.0
	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); return x;
}

function MM_findObj(n, d) {
	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&&!document.layers)
	x=document.getElementById(n); return x;
} 

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
		obj.visibility=v; obj.top=args[3]; obj.left=args[4]; }
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}



//NEW - added js for new 'POP-UP' div payment

function showFirstPayDiv(sTitle, sCost, sImg, sType) { 
	
	parent.MM_showHideLayers('payOptlay','','hide','1','1');
	parent.writit(sTitle, 'orderTitle');
	parent.writit(sCost, 'spnCost');
	parent.writit(sImg, 'spnGameImg');
	parent.writit(sType + ' ', 'prodType');
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		leftpos = parent.document.body.clientWidth / 2 - 250;
	}
	else {
		leftpos = parent.window.innerWidth / 2 - 250;
	}
	
	//leftpos = findPosX(parent.document.getElementById('content'))
	//basey = findPosY(parent.document.getElementById('footer')) - 400;

	toppos = parent.document.body.scrollTop + 100;
	
	parent.MM_showHideLayers('smsbuylay','','show',toppos+'px',leftpos+'px');
}

//JS for non web2wap pop-up
function showFirstPayDivNON(sTitle, sCost, sImg, sType, sShortCode, sForwardLine, sCSno) { 
	
	parent.MM_showHideLayers('payOptlay','','hide','1','1');
	parent.writit(sTitle, 'orderTitle');
	parent.writit(sCost, 'spnCost');
	parent.writit(sImg, 'spnGameImg');
	//parent.writit(sType + ' ', 'prodType');
	
	//parent.writit(sShortCode, 'spnShort');
	//parent.writit(sForwardLine, 'spnProdID');
	parent.writit(sCSno, 'spnCSNo');
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		leftpos = parent.document.body.clientWidth / 2 - 250;
	}
	else {
		leftpos = parent.window.innerWidth / 2 - 250;
	}
	
	//leftpos = findPosX(parent.document.getElementById('content'))
	//basey = findPosY(parent.document.getElementById('footer')) - 400;

	toppos = parent.document.body.scrollTop + 100;
	
	parent.MM_showHideLayers('smsbuylay','','show',toppos+'px',leftpos+'px');
}

function showFirstPayDivOutUK(sTitle, sCost, sImg, sType, sShortCode, sForwardLine, sCSno) { 
	
	writit('', 'divBaskNew');
	
	parent.MM_showHideLayers('payOptlay','','hide','1','1');
	parent.writit(sTitle, 'orderTitle2');
	parent.writit(sCost, 'spnCost2');
	parent.writit(sImg, 'spnGameImg2');
	parent.writit(sType + ' ', 'prodType2');
	
	parent.writit(sShortCode, 'spnShort2');
	parent.writit(sForwardLine, 'spnProdID2');
	parent.writit(sCSno, 'spnCSNo2');
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		leftpos = parent.document.body.clientWidth / 2 - 250;
	}
	else {
		leftpos = parent.window.innerWidth / 2 - 250;
	}
	
	//leftpos = findPosX(parent.document.getElementById('content'))
	//basey = findPosY(parent.document.getElementById('footer')) - 400;

	toppos = parent.document.body.scrollTop + 100;
	
	parent.MM_showHideLayers('smsbuylayNonUK','','show',toppos+'px',leftpos+'px');
}

function updateShoppingBasket2() {
	parent.MM_showHideLayers('smsbuylay','','hide','1','1');
	parent.MM_showHideLayers('smsresplay','','hide','1','1');
	 
	refreshBask();
}

function updateBasketandLocDivs() {
	refreshBask();
	//refreshLocDiv();
}

function updateLocDiv() {
	refreshLocDiv();
}

function updateShoppingBasket3(sLoc) {
	parent.MM_showHideLayers('payOptlay','','hide','1','1');
	//parent.writit(sLoc, 'divLocFlag');
	
	//loop through mymobilenumber ddl and make country selected
	//for(var i=0, i<=document.selcountry.code.length, i++) {
		//if(document.selcountry.code[i].value.indexof('-'+sLoc) != -1) {
			//document.selcountry.code[i].selected = true;
		//}
	//}
	
	refreshBask();
}

function showSMSbuy() { 
	//makeRequest(sLocationURL+"basket/SMSPane.aspx?"+(new Date().getTime())); 
	writit('', 'divBaskNew');
}

function showSMSbuy2(sTitle, sCost, sImg, sType) { 
	//makeRequest(sLocationURL+"basket/SMSPane.aspx?"+(new Date().getTime()));
	writit('', 'divBaskNew');
	showFirstPayDiv(sTitle, sCost, sImg, sType);
}

//JS for non web2wap pop-up
function showSMSbuy2NON(sTitle, sCost, sImg, sType, sShortCode, sForwardLine, sCSno) { 
	//makeRequest(sLocationURL+"basket/SMSPane.aspx?"+(new Date().getTime()));
	writit('', 'divBaskNew');
	showFirstPayDivNON(sTitle, sCost, sImg, sType, sShortCode, sForwardLine, sCSno);
}

function hideBuydiv() {
	parent.MM_showHideLayers('smsbuylay','','hide','1','1');
}

function hideBuydivNON() {
	parent.MM_showHideLayers('smsbuylayNonUK','','hide','1','1');
}

function closeOptDiv() { 
	parent.MM_showHideLayers('payOptlay','','hide','1','1');
}

function showFirstPayDiv2() { 
	
	parent.MM_showHideLayers('payOptlay','','hide','1','1');
	//parent.writit(sTitle, 'orderTitle');
	//parent.MM_showHideLayers('smsbuylay','','show','300','280');
	//alert('firstpaydiv2');
	basketFrame.location = sLocationURL + "basket/update.aspx?task=smssel";
}

function noSMSOrder() { 
	basketFrame.location = sLocationURL + "basket/update.aspx?task=smsrem";
}

function noSMSOrderNonUK() { 
	basketFrame.location = sLocationURL + "basket/update.aspx?task=smsremnonuk";
}

function noSMSOrder2() { 
	basketFrame.location = sLocationURL + "basket/update.aspx?task=smsremunav";
}

function orderItem(msisdn) { 
	top.basketFrame.location = sLocationURL + "basket/SMSorder.aspx?msisdn=" + msisdn;
}

function changeCardPay() { 
	parent.MM_showHideLayers('payOptlay','','hide','1','1');
	basketFrame.location = sLocationURL + "basket/update.aspx?task=cardsess";
}
function changeCardPay2() { 
	parent.MM_showHideLayers('smsbuylay','','hide','1','1');
	parent.MM_showHideLayers('smsbuylayNonUK','','hide','1','1');
	basketFrame.location = sLocationURL + "basket/update.aspx?task=cardsess";
}
	
function closeRespDiv() { 
	
	MM_showHideLayers('smsresplay','','hide','1','1');
}
function closeOptwin() { basketFrame.location = sLocationURL + "basket/update.aspx?task=payoptclose"; }

function writtext(stext, divid) {
	if (document.getElementById) {
		document.getElementById(divid).innerHTML = stext;
	}
	else if (document.all) {
		document.all[divid].innerHTML = stext;
	}
	else if (document.layers) {
		x = document.layers[divid];
		text2 = stext;
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}

function clearDivs() {
	parent.MM_showHideLayers('smsbuylay','','hide','1','1');
	parent.MM_showHideLayers('smsresplay','','hide','1','1');
	parent.MM_showHideLayers('payOptlay','','hide','1','1');
}

function changeSMSPay() { basketFrame.location = sLocationURL + "basket/update.aspx?task=smssess"; }

function showPaySelDiv(sTitle, sCost, sImg, sType) {
	parent.writit(sTitle, 'spnSelItem');
	parent.writit(sTitle, 'orderTitle');
	
	parent.writit(sCost, 'spnCost');
	parent.writit(sImg, 'spnGameImg');
	parent.writit(sType+' ', 'prodType');
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		leftpos = parent.document.body.clientWidth / 2 - 250;
	}
	else {
		leftpos = parent.window.innerWidth / 2 - 250;
	}
	
	toppos = parent.document.body.scrollTop + 100;
	
	parent.MM_showHideLayers('payOptlay','','show',toppos+'px',leftpos+'px');
}

function showPaySelDivNew(sTitle) {
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		leftpos = parent.document.body.clientWidth / 2 - 250;
	}
	else {
		leftpos = parent.window.innerWidth / 2 - 250;
	}
	
	toppos = parent.document.body.scrollTop + 100;
	
	parent.MM_showHideLayers('payOptlay','','show',toppos+'px',leftpos+'px');
}

function setCountry(sCode) { basketFrame.location = sLocationURL + "basket/update.aspx?task=countrydiv&countrysel="+sCode; }

function showRespDiv(sRespTxt) {
	//alert(sRespTxt);
	parent.MM_showHideLayers('smsbuylay','','hide','1','1');
	
	//add response respMess
	writit(sRespTxt, 'respMess');
	writit('<img src=' + sLocationURL + 'images/animated-arrow.gif border=0 width=400 height=200>', 'respImg');
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		leftpos = parent.document.body.clientWidth / 2 - 250;
	}
	else {
		leftpos = parent.window.innerWidth / 2 - 250;
	}
	
	toppos = parent.document.body.scrollTop + 100;
	
		
	parent.MM_showHideLayers('smsresplay','','show',toppos+'px',leftpos+'px');
}

function showRespDiv2(sRespTxt) {
	//alert(sRespTxt);
	parent.MM_showHideLayers('smsbuylay','','hide','1','1');
	
	//add response respMess
	writit(sRespTxt, 'respMess');
	//writit('<img src=' + sLocationURL + 'images/animated-arrow.gif border=0 width=400 height=200>', 'respImg');
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		//toppos = parent.document.body.clientHeight / 2 - 200;
		leftpos = parent.document.body.clientWidth / 2 - 250;
	}
	else {
		//toppos = parent.window.innerHeight / 2 - 200;
		leftpos = parent.window.innerWidth / 2 - 250;
	}
	
	//e = window.event;
	//startx = event_x(e);
	//starty = event_y(e);
	//alert(tempY);
	leftpos = findPosX(parent.document.getElementById('content'))
	basey = findPosY(parent.document.getElementById('footer')) - 400;
	//alert(basey);
	//alert(parent.document.getElementById('footer').scrollTop);
	toppos = parent.document.documentElement.scrollTop + 100;
	
		
	parent.MM_showHideLayers('smsresplay','','show',toppos+'px',leftpos+'px');
	//showSMSbuy();
}

function showFeeddiv(alertName, keyWord, sShort, sSuppNo) {
	MM_showHideLayers('alerttextlay','','hide',1,1);
	writtext(alertName + ' ', 'alertTitle');
	writtext(alertName + ' ', 'alertTitle1');
	writtext(keyWord + ' ', 'alertkey');
	writtext(keyWord + ' ', 'alertkey1');
	
	writtext(sShort, 'spnalertno');
	writtext(sShort, 'spnalertno1');
	
	writtext(sSuppNo, 'spncustsuppno');
	
	toppos = document.body.scrollTop + 100;
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		leftpos = document.body.clientWidth / 2 - 250;
	}
	else {
		leftpos = window.innerWidth / 2 - 250;
	}
	
	MM_showHideLayers('alerttextlay','','show',toppos+'px',leftpos+'px');
}

function showCountryUnavail(sTitle, sLoc) {
	
	parent.MM_showHideLayers('payOptlay','','hide','1','1');
	
	parent.writtext(sTitle + ' ', 'unavaprod');
	parent.writtext(sLoc, 'unavaloc');
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		leftpos = parent.document.body.clientWidth / 2 - 250;
	}
	else {
		leftpos = parent.window.innerWidth / 2 - 250;
	}
	
	//leftpos = findPosX(parent.document.getElementById('content'))
	//basey = findPosY(parent.document.getElementById('footer')) - 400;

	toppos = parent.document.body.scrollTop + 100;
	
	parent.MM_showHideLayers('smsunavaillay','','show',toppos+'px',leftpos+'px');
}

function hideUnavaildiv() {
	parent.MM_showHideLayers('smsunavaillay','','hide','1','1');
}

function updateCountry(sUrl) {
	var checkddl = "";
	checkddl = document.selcountry.code.options[document.selcountry.code.selectedIndex].value;
	
	if (checkddl != "") {
		//update cookie and set card pay (if ww)
		basketFrame.location = sLocationURL + "basket/update.aspx?task=setlocation&newloc=" + checkddl + "&repage=" + sUrl;
	}
	else {
		alert('Please select your country from the list');
	}
	
	//parent.window.location = sUrl;
}

function updateCountry2(sUrl, sCoCode) {
	basketFrame.location = sLocationURL + "basket/update.aspx?task=setlocation&newloc=" + sCoCode + "&repage=" + sUrl;
}

function updateCountryold() {
	var checkddl = "";
	checkddl = document.selcountry.code.options[document.selcountry.code.selectedIndex].value;
	
	if (checkddl != "") {
		//update cookie and set card pay (if ww)
		basketFrame.location = sLocationURL + "basket/update.aspx?task=setlocation&newloc=" + checkddl;
	}
	else {
		alert('Please select your country from the list');
	}
}

function updateCheckoutNewLoc(sUrl) {
	parent.window.location = sUrl;
}


