function
			popUp(URL,thewidth,theheight,theleft,thetop,thetoolbar,thescrollbars,thelocationbar,thestatus,themenubar,theresizable,id) {
			if (typeof(URL)=="undefined"){
				URL='http://www.carphonewarehouse.com';
			}
			if (typeof(id)=="undefined"){id='cpw'}
			if (typeof(thetoolbar)=="undefined"){thetoolbar=0}
			if (typeof(thescrollbars)=="undefined"){thescrollbars=1}
			if (typeof(thelocationbar)=="undefined"){thelocationbar=0}
			if (typeof(thestatus)=="undefined"){thestatus=0}
			if (typeof(themenubar)=="undefined"){themenubar=0}
			if (typeof(theresizable)=="undefined"){theresizable=0}
			if (typeof(thewidth)=="undefined"){thewidth=800}
			if (typeof(theheight)=="undefined"){theheight=400}
			if (typeof(theleft)=="undefined"){theleft=200}
			if (typeof(thetop)=="undefined"){thetop=100}

			eval(id+"popup=window.open('"+URL+"','" + id + "','toolbar="+thetoolbar+",scrollbars="+thescrollbars+",location="+thelocationbar+",status="+thestatus+",menubar="+themenubar+",resizable="+theresizable+",width="+thewidth+",height="+theheight+",left = "+theleft+",top = "+thetop+"');");
			}
		
// start new popupwindow function  
function PopupWindow(filename, type) { 
 
// Choose type of options for the popup window, can't have any spaces in between options 
    if (type == "display") { 
        var popupOptions = "toolbar=no,scrollbars=no,status=no,menubar=no,resizable=0,copyhistory=no,width=510,height=290,top=100,left=200"; 
    } 
    else if (type == "diplayscroll") { 
        var popupOptions = "toolbar=no,scrollbars=yes,status=no,menubar=no,resizable=1,copyhistory=no,width=510,height=290,top=100,left=200"; 
    } 
    else if (type == "product") { 
        var popupOptions = "toolbar=no,scrollbars=no,status=no,menubar=no,resizable=0,copyhistory=no,width=300,height=300,top=100,left=200"; 
    } 
    else if (type == "ringtoneHandSetCheck") { 
        var popupOptions = "toolbar=no,scrollbars=no,status=no,menubar=no,resizable=0,copyhistory=no,width=300,height=300,top=100,left=200"; 
    } 
    else if (type == "assisted") { 
        var popupOptions = "toolbar=no,scrollbars=yes,status=no,menubar=no,resizable=0,copyhistory=no,width=400,height=400,top=100,left=200"; 
    } 
    else if (type == "clickToCall") { 
        var popupOptions = "toolbar=no,scrollbars=no,status=no,menubar=no,resizable=0,copyhistory=no,width=600,height=400,top=100,left=200"; 
    } 
    else if (type == "frontCall") { 
        var popupOptions = "toolbar=no,scrollbars=yes,status=no,menubar=no,resizable=0,copyhistory=no,width=650,height=500,top=100,left=200"; 
    } 
    else if (type == "cv2") { 
        var popupOptions = "toolbar=no,scrollbars=no,status=no,menubar=no,resizable=0,copyhistory=no,width=480,height=260,top=100,left=200"; 
    } 
    else if (type == "clone") { 
        var popupOptions = ""; 
    } 
     
    // Open window called popup using filename and options. 
    popup = eval("window.open(filename, '_blank', '" + popupOptions + "')"); 
} 
// end new popupwindow function  


	// -->

		<!--
		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_setTextOfLayer(objName,x,newText) { //v4.01
			if ((obj=MM_findObj(objName))!=null) with (obj)
			if (document.layers) {document.write(unescape(newText)); document.close();}
			else innerHTML = unescape(newText);
		}

		function popupOut() {
			popUp('/commerce/servlet/gben-server-PageServer?article=PRODDISPLAY.WEBSTOCK.GLOBAL&SERVLET=gben-server-PageServer&TOPARTICLE=POPUPTOP&CONTENT_POS=OUTSTOCK_POPUP&CONTENTARTICLE=PRODDISPLAY.WEBSTOCK.GLOBAL&TOPSTYLE=popuptop&CONTENTSTYLE=popupcontent',490,430);
		}  

		function popupIn() {
			popUp('/commerce/servlet/gben-server-PageServer?article=PRODDISPLAY.WEBSTOCK.GLOBAL&SERVLET=gben-server-PageServer&TOPARTICLE=POPUPTOP&CONTENT_POS=INSTOCK_POPUP&CONTENTARTICLE=PRODDISPLAY.WEBSTOCK.GLOBAL&TOPSTYLE=popuptop&CONTENTSTYLE=popupcontent',490,430);
		}  

		function popupLow() {
			popUp('/commerce/servlet/gben-server-PageServer?article=PRODDISPLAY.WEBSTOCK.GLOBAL&SERVLET=gben-server-PageServer&TOPARTICLE=POPUPTOP&CONTENT_POS=LOWSTOCK_POPUP&CONTENTARTICLE=PRODDISPLAY.WEBSTOCK.GLOBAL&TOPSTYLE=popuptop&CONTENTSTYLE=popupcontent',490,430);
		}  
		// -->
		
// TAB SWAPPING FUNCTIONS
       
function swapMainContent(divID) {
       
        /* Hide all divs */
        if (document.getElementById('iphoneOverview')) { document.getElementById('iphoneOverview').style.display = 'none'; }
        if (document.getElementById('iphoneRevolutionary')) { document.getElementById('iphoneRevolutionary').style.display = 'none'; }
        if (document.getElementById('iphoneWidescreen')) { document.getElementById('iphoneWidescreen').style.display = 'none'; }
        if (document.getElementById('iphoneInternet')) { document.getElementById('iphoneInternet').style.display = 'none'; }
        if (document.getElementById('iphoneSpecifications')) { document.getElementById('iphoneSpecifications').style.display = 'none'; }
       
        /* Show selected Div */
        if (document.getElementById(divID)) { document.getElementById(divID).style.display = 'block'; }
}

function swapSubContent(divID) {
       
        /* Hide all divs */
        if (document.getElementById('iphoneQuickStart')) { document.getElementById('iphoneQuickStart').style.display = 'none'; }
        if (document.getElementById('iphoneExistingCustomers')) { document.getElementById('iphoneExistingCustomers').style.display = 'none'; }
        if (document.getElementById('iphoneEligibility')) { document.getElementById('iphoneEligibility').style.display = 'none'; }
        if (document.getElementById('iphoneNewToO2')) { document.getElementById('iphoneNewToO2').style.display = 'none'; }
        if (document.getElementById('iphonePayAsYouGo')) { document.getElementById('iphonePayAsYouGo').style.display = 'none'; }
        if (document.getElementById('iphoneActivation')) { document.getElementById('iphoneActivation').style.display = 'none'; }
        if (document.getElementById('iphoneBasicRequirements')) { document.getElementById('iphoneBasicRequirements').style.display = 'none'; }
        if (document.getElementById('iphoneFAQs')) { document.getElementById('iphoneFAQs').style.display = 'none'; }
       
        /* Show selected Div */
        if (document.getElementById(divID)) { document.getElementById(divID).style.display = 'block'; }
}

function swapPrimeContent(divID) {
       
        /* Hide all divs */
        if (document.getElementById('iphonePaym')) { document.getElementById('iphonePaym').style.display = 'none'; }
        if (document.getElementById('iphonePayg')) { document.getElementById('iphonePayg').style.display = 'none'; }
        
       
        /* Show selected Div */
        if (document.getElementById(divID)) { document.getElementById(divID).style.display = 'block'; }
}

function swapMthSubContent(divID) {
       
        /* Hide all divs */
        if (document.getElementById('iphoneMthKeyFeatures')) { document.getElementById('iphoneMthKeyFeatures').style.display = 'none'; }
        if (document.getElementById('iphoneMthExistCustomers')) { document.getElementById('iphoneMthExistCustomers').style.display = 'none'; }
        if (document.getElementById('iphoneMthEligibility')) { document.getElementById('iphoneMthEligibility').style.display = 'none'; }
        if (document.getElementById('iphoneMthNewToO2')) { document.getElementById('iphoneMthNewToO2').style.display = 'none'; }
        if (document.getElementById('iphoneMthPayAsYouGo')) { document.getElementById('iphoneMthPayAsYouGo').style.display = 'none'; }
        if (document.getElementById('iphoneMthActivation')) { document.getElementById('iphoneMthActivation').style.display = 'none'; }
        if (document.getElementById('iphoneMthBasicReq')) { document.getElementById('iphoneMthBasicReq').style.display = 'none'; }
        if (document.getElementById('iphoneMthFAQs')) { document.getElementById('iphoneMthFAQs').style.display = 'none'; }
       
        /* Show selected Div */
        if (document.getElementById(divID)) { document.getElementById(divID).style.display = 'block'; }
} 



// --> 


function iphoneSmallPrint(sh)
{
	if(sh == 'hide')
	{
		document.getElementById('iphoneSmallPrintText').style.display = 'none';
		document.getElementById('iphoneSmallPrintTitleShow').style.display = 'block';
		document.getElementById('iphoneSmallPrintTitleHide').style.display = 'none';
	}
	else
	{
		if (sh == 'show')
		{
			document.getElementById('iphoneSmallPrintText').style.display = 'block';
			document.getElementById('iphoneSmallPrintTitleShow').style.display = 'none';
			document.getElementById('iphoneSmallPrintTitleHide').style.display = 'block';
		}
	}	
}


function checkUpgrade()
{
	var iPu = Querystring.get('ipu','');
	if ( iPu.length == 0 ) 
	{
		iPu = Cookie.get('ipu','');
	}
	else 
	{	
		Cookie.set('ipu',iPu);
	}
	if (iPu == 1) 
	{	
		swapiPhoneTabs(2);
	};
	if (iPu == 2) 
	{	
		swapiPhoneTabs(4);
	};
}			

function swapiPhoneTabs(tab)
{
	if(tab == 1)
	{
		document.getElementById('iPhoneMainUpgrades').style.display = 'none';
		document.getElementById('iPhoneMainFeatures').style.display = 'none';
		document.getElementById('iPhoneMainTariffs').style.display = 'block';
		document.getElementById('iPhoneMain3GOnly').style.display = 'none';
		document.getElementById('terms3g').style.display = 'none';
		document.getElementById('terms3gs').style.display = 'block';
		document.getElementById('topBanner3G').style.display = 'none';
		document.getElementById('topBanner3Gs').style.display = '';
	}
	if(tab == 2)
	{
		document.getElementById('iPhoneMainUpgrades').style.display = 'block';
		document.getElementById('iPhoneMainFeatures').style.display = 'none';
		document.getElementById('iPhoneMainTariffs').style.display = 'none';
		document.getElementById('iPhoneMain3GOnly').style.display = 'none';
		document.getElementById('terms3g').style.display = 'none';
		document.getElementById('terms3gs').style.display = 'block';
		document.getElementById('topBanner3G').style.display = 'none';
		document.getElementById('topBanner3Gs').style.display = '';
	}
	if(tab == 3)
	{
		document.getElementById('iPhoneMainUpgrades').style.display = 'none';
		document.getElementById('iPhoneMainFeatures').style.display = 'block';
		document.getElementById('iPhoneMainTariffs').style.display = 'none';
		document.getElementById('iPhoneMain3GOnly').style.display = 'none';
		document.getElementById('terms3g').style.display = 'none';
		document.getElementById('terms3gs').style.display = 'block';
		document.getElementById('topBanner3G').style.display = 'none';
		document.getElementById('topBanner3Gs').style.display = '';
	}
	if(tab == 4)
	{
		document.getElementById('iPhoneMainUpgrades').style.display = 'none';
		document.getElementById('iPhoneMainFeatures').style.display = 'none';
		document.getElementById('iPhoneMainTariffs').style.display = 'none';
		document.getElementById('iPhoneMain3GOnly').style.display = 'block';
		document.getElementById('terms3g').style.display = 'block';
		document.getElementById('terms3gs').style.display = 'none';
		document.getElementById('topBanner3G').style.display = '';
		document.getElementById('topBanner3Gs').style.display = 'none';
	}
}