//function sGifts() {
//var s=s_gi(s_account);
//s.linkTrackVars='events';
//s.linkTrackEvents='event3';
//s.events='event3';
//s.tl(this,'o','PhotoGiftDownload link');
//}
var pageTracker1;

function sUploadOmniture(){
	var s=s_gi(s_account);
	s.linkTrackVars='events';
	s.linkTrackEvents='event1';
	s.events='event1';
	s.tl(this,'o','FreeDownload link');
}

function sGiftsOmniture(){
	var s=s_gi(s_account);
	s.linkTrackVars='events';
	s.linkTrackEvents='event2';
	s.events='event2';
	s.tl(this,'o','Getstarted link');
}

function sBooksOmniture(){
	var s=s_gi(s_account);
	s.linkTrackVars='events';
	s.linkTrackEvents='event4';
	s.events='event4';
	s.tl(this,'o','Photobooks download');
	}

//function sBooks() {
//var s=s_gi(s_account);
//s.linkTrackVars='events';
//s.linkTrackEvents='event4';
//s.events='event4';
//s.tl(this,'o','PhotoBookDownload link');
//}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(doGALink(theURL),winName,features);
}
function openWin(URL,aName,wName,Scroll,W,H,T,L) { //v2.0
	window.name = aName; aWindow = window.open(doGALink(URL),wName,"toolbar=no,location=no,directories=no,status=no,scrollbars="+ Scroll +",width="+ W +",height="+ H +",top="+ T +",left="+ L +",resizable=no,menubar=no");
}

function MM_openBrWindow2()
{
  window.open(lmgLocation+"mainpricing.html","","toolbar=no,scrollbars=yes,resizable=yes,width=665,height=450");
}


function MM_openBrWindow3(theURL,winName,features) { //v2.0
  window.open(doGALink(theURL),winName,features);
}
	
function MM_openBrWindow4() { //v2.0
  window.open(doGALink('http://www.bonusprint.co.uk/pages/nominate.htm'),"","toolbar=no,scrollbars=no,resizable=no,width=700,height=520");
}
function MM_openBrWindow5() { //v2.0
  window.open(doGALink('http://www.bonusprint.co.uk/pages/legal.htm'),"legal","toolbar=no,scrollbars=yes,resizable=no,width=600,height=530");
}
function MM_openBrWindow6() { //v2.0
  window.open(doGALink("http://www.bonusprint.co.uk/pages/privacy.htm"),"privacy","toolbar=no,scrollbars=yes,resizable=no,width=600,height=530");
}
function MM_openBrWindow7() { //v2.0
 
 window.open(doGALink("http://print.fotowire.com/f2f/start.aspx?wuid=4bba20039b544ded94b2dc828c762bfd&lang=en"),"legal","toolbar=yes,scrollbars=yes, resizable=yes,location=yes, width=690, height=560");
}

function MM_disneyBorders(){
window.open(doGALink("http://www.bonusprint.co.uk/pages/disney/cards/cars_standard.htm"),"Disney","toolbar=no,menubar=no,scrollbars=yes,resizable=no,width=555,height=635");
}

function ordergreetingcards() {
		var x = (screen.availHeight - 490)/2;
		var y = (screen.availWidth - 660)/2;
		ref = getCookieValue();
		window.open(doGALink("http://webalbum.bonusprint.com/UKGC01/main.aspx?refer=" + ref), null, "top="+x+",left="+y+",height=490,width=660,status=0,scrollbars=0,resizable=0,toolbar=0,menubar=0,titlebar=0;location=0");
	}
function htmlUploadOld() {
		ref = getCookieValue();
		window.location = doGALink("http://webalbum.bonusprint.com/ukipc01/default.aspx?level=0&sub=1&refer=" + ref);		
	}
//Browser upload Generic
function htmlUpload(productgroup, parentloc) {
ref = getCookieValue();
var link="http://webalbum.bonusprint.com/ukipc01/default.aspx?level=0&sub=1&refer=" + ref; 
if(productgroup != null){
link += "&productgroup="+ productgroup;
}

  if(parentloc != null && parentloc==1){
   opener.location=doGALink(link);
  }else{
  	window.location = doGALink(link);
  }
 
 } 

//End Browser upload Generic//

//Browser upload by product
function htmlUploadProduct(productID,cal) {
var link;
ref = getCookieValue();
if(cal == null || cal == 0){
	link="http://webalbum.bonusprint.com/ukipc01/default.aspx?level=0&sub=1&refer=" + ref;	
}else if(cal == 1){
	link="http://webalbum.bonusprint.com/ukipc01/basket.aspx?level=4&refer=" + ref; 
}
if(productID != null){
link += "&productID="+ productID+ "&productType=REORD";
}

window.location = doGALink(link);
}  
//End Browser upload by product//

function orderDisneycards() {
		var x = (screen.availHeight - 490)/2;
		var y = (screen.availWidth - 660)/2;
		ref = getCookieValue();
		
		window.open(doGALink("http://webalbum.bonusprint.com/disneygc/main.aspx?refer=" + ref), null, "top="+x+",left="+y+",height=490,width=660,status=0,scrollbars=0,resizable=0,toolbar=0,menubar=0,titlebar=0;location=0");
	}
	
function htmluploadclick(source){
		//document.getElementById("myimg").src ="recordclick.asp";
		//document.writeln('<IMG src="recordclick.asp?myparam=gotit" height="1px" width="1px" id="myimg">');
		var params='?source='+source;
		document.getElementById("trackerimg").src="htmluploadclick.asp"+params;
	}

	function photobooklanding() {
	    //var params = '?source=' + source;
	    document.getElementById("trackerimg").src = "photobooklanding.asp";
	}
	
function getCookieValue()
{
	var dc = document.cookie;
	var prefix = "refer=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
    	begin = dc.indexOf(prefix);
    		if (begin != 0) return "empty";
  			} else
    		begin += 2;
  		var end = document.cookie.indexOf(";", begin);
  		if (end == -1)
    	end = dc.length;
		return unescape(dc.substring(begin + prefix.length, end));
}

function Aopensnappc(){
window.open('pc_download_thanks.asp', 'Pc_Thanks', 'height=586, width=460,noresizable ,noscrollbars');						
					}

function Aopensnapmac(){
window.open('mac_download_thanks.asp', 'Mac_Thanks', 'height=610, width=450,noresizable ,noscrollbars');						
					}
					
function webAlbumClick(){
	var ref = getCookiee();
	var URL = 'http://webalbum.bonusprint.com/uk/selectAlbum.aspx?level=7&refer=' +ref;
	window.location =doGALink(URL);
}		
					
function nOver(dn)
{

if (document.all)
{

document.all["mask"].style.visibility ='visible';
}
else
	{
document.getElementById("mask").style.visibility =('visible');

	}

DpDown=1;
	for(var i=0;i< barDat.menuPaneNum ;i++)
	{
		var bitts='LA'+i;
		var bittse='LE'+ i ;
		var bittsb='LC'+ i ;
		var bitto='ma' + i;
		
		document[bitto].src= lmgLocation+ "images/bar"+i+((dn==i)?"_on.gif":"_off.gif");
		for(var j = 0; j < ark[i].length; j++)
		{

if (document.all)
{
			document.all[bitts + j].style.visibility = ((dn==i)?'visible':'hidden');
			document.all[bittse + j].style.visibility = ((dn==i)?'visible':'hidden');
			document.all[bittsb + j].style.visibility = ((dn==i)?'visible':'hidden');
}
else
			{
				document.getElementById(bitts + j).style.visibility = ((dn==i)?"visible":"hidden");
				document.getElementById(bittse + j).style.visibility = ((dn==i)?'visible':'hidden');
				document.getElementById(bittsb + j).style.visibility = ((dn==i)?'visible':'hidden');

			}
			
		}
	}	

}

function nOut(dn)
{


if((ark[dn].length==0) ||(( DpDown<0) && (ark[dn].length>0)))

{

DpDown=1;
	pageOFF(Onpage);

	HideBar(dn);

if (document.all)
{
document.all["mask"].style.visibility ='visible';

}
else
	{
document.getElementById("mask").style.visibility =('visible');

	}

}

}

function bOver(dn,on)
{

DpDown=on;
	var bittac='im'+dn + on;
	document[bittac].src =lmgLocation+ "images/sw0_on.gif";
	
	var bittsb='LC'+ dn ;

if (document.all)
{
document.all[bittsb + on].style.color = '#FFFFFF';

}
else
	{
	document.getElementById(bittsb + on).style.color = '#FFFFFF';


	}
pageOFF(dn);


}

function bOut(dn,en){


	var bittas='im' + dn +en;
	document[bittas].src =lmgLocation+ "images/sw1_off.gif";
	var bittsb='LC'+ dn ;

if (document.all)
{
document.all[bittsb + en].style.color = '#0000ff';

}
else
	{
		document.getElementById(bittsb + en).style.color = '#0000ff';

	}


if (document.all)
{
document.all["mask"].style.visibility = 'visible';

}
else
	{
			document.getElementById("mask").style.visibility =('visible');

	}


}


function pageOn(highlight)
{
if(highlight>=barDat.menuPaneNum)
	{
highlight=0;

	}
PgHighLight = highlight;
		var bitto='ma' +highlight;
		document[bitto].src=lmgLocation+ "images/bar"+highlight+"_on.gif";

}

function pageOFF(offBar)
{


var bitto='ma';
	for(var inx=0; inx<barDat.menuPaneNum;inx++)
	{
		bitto='ma' +inx;
		if( inx==offBar )
		{
		document[bitto].src=lmgLocation+ "images/bar"+offBar+"_on.gif";

		}

		else
		{		
			document[bitto].src=lmgLocation+ "images/bar"+inx+"_off.gif";

		}

	}

}

function mOver(dn)
{

	for(var i=0;i< barDat.menuPaneNum ;i++){
		var bitts='LA'+i;
		var bittse='LE'+ i ;
		var bittsb='LC'+ i ;

		var bitto='ma' +i;
		
		for(var j = 0; j < ark[i].length; j++)
		{
		
				if (document.all)
				{
			document.all[bitts + j].style.visibility = 'hidden';
			document.all[bittse + j].style.visibility = 'hidden';
			document.all[bittsb + j].style.visibility = 'hidden';

				}
				else
			{
					document.getElementById(bitts + j).style.visibility = ('hidden');
					document.getElementById(bittse + j).style.visibility = ('hidden');
					document.getElementById(bittsb + j).style.visibility =('hidden');

			}

		}
	}	

	pageOFF(Onpage);


				if (document.all)
				{
				document.all["mask"].style.visibility ='hidden';
				}
				else
			{
					document.getElementById("mask").style.visibility =('hidden');


			}


}

function HideBar(dn)
{
	var bitts='LA'+ dn ;
	var bittse='LE'+ dn ;
	var bitto='ma' +dn;
	var bittsb='LC'+ dn ;

	document[bitto].src=lmgLocation+ "images/bar"+dn+"_off.gif";
for(var j = 0; j <  ark[dn].length; j++)
	{

				if (document.all)
				{
					document.all[bitts + j].style.visibility = 'hidden';
					document.all[bittse + j].style.visibility = 'hidden';
					document.all[bittsb + j].style.visibility = 'hidden';

				}
				else
				{
					document.getElementById(bitts + j).style.visibility = ('hidden');
					document.getElementById(bittse + j).style.visibility = ('hidden');
					document.getElementById(bittsb + j).style.visibility =('hidden');


				}

	}

}


function replace(string,text,by) {
    // Replaces text with by in string
    var i = string.indexOf(text), newstr = '';
    if ((!i) || (i == -1))
        return string;
    newstr += string.substring(0,i) + by;
    if (i+text.length < string.length)

        newstr += replace(string.substring(i+text.length,string.length),text,by);
    return newstr;
}


function getParm(parm) {
    // returns value of parm from string

    var startPos = string.indexOf(parm + "=");
    if (startPos > -1) {
        startPos = startPos + parm.length + 1;
        var endPos = string.indexOf("&",startPos);
        if (endPos == -1)
            endPos = string.length;


        return unescape(string.substring(startPos,endPos));
    }
    return '';
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

var comsnapwinmp;
										
function qchart(){
						comsnapwinmp = window.open('quality_chart.htm', "comsnapwinmp", "height=600, width=480,resizable ,scrollbars=no");						
					}
var theImages = new Array()

theImages[0] = 'images/testimonials_4.gif'
theImages[1] = 'images/testimonials_2.gif'
theImages[2] = 'images/testimonials_3.gif'
theImages[3] = 'images/testimonials_1.gif'
theImages[4] = 'images/testimonials_5.gif'
//theImages[5] = 'images/testimonials_6.jpg'
//theImages[6] = 'images/testimonials_7.jpg'

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
	preBuffer[i] = new Image()
	preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));

function showImage(){
	document.write('<img src="'+theImages[whichImage]+'" width=150 height=65 border=0 alt="quality, first-class service">');

}

function Aopensnap(){
						comsnapwinmp = window.open('../global/bonus_global_pop_up.htm', "comsnapwinmp", "height=270, width=320,toolbar=no,menubar=no,resizable=no");						
					}

	function formHandler() {
  var Current = document.LocalSite.Country.selectedIndex;
  if (document.LocalSite.Country.selectedIndex != 0 ) {
    window.location.href = document.LocalSite.Country.options[Current].value;
    return false;
	}
 }

//************FLAGS HOME PAGE*******************//

		function preload(){ this.length = preload.arguments.length;for(var i=0; i<this.length; i++){this[i] = new Image();this[i].src = preload.arguments[i];}}
		var pics2 = new preload("pages/images/flag1.jpg","pages/images/flag1_on.jpg","pages/images/flag2.jpg","pages/images/flag2_on.jpg","pages/images/flag3.jpg","pages/images/flag3_on.jpg","pages/images/flag4.jpg","pages/images/flag5_on.jpg","pages/images/flag6_on.jpg","pages/images/flag7_on.jpg","pages/images/flag4_off.jpg","pages/images/flag5.jpg");

	function flagname(Fgname){
		var TempVar ="flag"+Fgname;

	document[TempVar].src="pages/images/flag"+Fgname+"_off.jpg";
	document["flagblank"].src="pages/images/flag"+Fgname+".jpg";
	}

	function flagnameOut(Fgname){
		var TempVar ="flag"+Fgname;

		document[TempVar].src="pages/images/flag"+Fgname+"_on.jpg";
		document["flagblank"].src="pages/images/flag10.jpg";
	}
	function callrecord(m_name,m_top,m_sub,m_link){
		//document.getElementById("myimg").src ="recordclick.asp";
		//document.writeln('<IMG src="recordclick.asp?myparam=gotit" height="1px" width="1px" id="myimg">');
		var params='?menuname='+m_name+'&toplevel='+m_top+'&sublevel='+m_sub+'&link="'+escape(m_link)+'"';
		document.getElementById("trackerimg").src="pages/recordclick.asp"+params;
	}
	
	function newLocation() {
		document.location.href = "http://www." + adURL[thisAd]
	}

	function formHandler() {
  		var Current = document.LocalSite.Country.selectedIndex;
  		if (document.LocalSite.Country.selectedIndex != 0 ) {
    		window.location.href = document.LocalSite.Country.options[Current].value;
    		return false;
		}
 	}
	
//************ENDS FFLAGS HOME PAGE*******************//

function checkForm()
{
var message = "";
	if(document.contactUs.firstname.value.length == 0 ) {
			message = "Please enter your first name!\n";
	}
else
	if(document.contactUs.surname.value.length == 0 ) {
			message = "Please enter your Surname!\n";
	}
else
	if (document.contactUs.message.value.length == 0 ) {
			message = "Please enter your message!\n";
	}

		var test = document.contactUs.email.value;
		var a =/\./;
		var b =/@/;
		var ra = test.match(a);
		var rb = test.match(b);
		if(!ra||!rb){
			message += "Please enter a valid email address\n";
		}

		if (message.length > 0) 
		{
		alert(message);
		message = "";
		return false;
		}
		else
		{
		    document.forms['contactUs'].submit();	
	
		}
}

function checkFormDiscount()
{
var message = "";
	if(document.contactUs.firstname.value.length == 0 ) {
			message = "Please enter your first name!\n";
	}
else
	if(document.contactUs.surname.value.length == 0 ) {
			message = "Please enter your Surname!\n";
	}
else
var message = "";
		var nazwa = /^\d{6,15}/;
	if(!nazwa.test(document.contactUs.customernumber.value)){
		message = "Please enter a valid order number!\n";
	
	}
	
	else

	if (document.contactUs.message.value.length == 0 ) {
			message = "Please enter your message!\n";
	}

		var test = document.contactUs.email.value;
		var a =/\./;
		var b =/@/;
		var ra = test.match(a);
		var rb = test.match(b);
		if(!ra||!rb){
			message += "Please enter a valid email address\n";
		}

		if (message.length > 0) 
		{
		alert(message);
		message = "";
		return false;
		}
		else
		{
		    document.forms['contactUs'].submit();	
	
		}
}
// Special function for the people FREE A5 card //
function ordergreetingcardsPeople() {
		var x = (screen.availHeight - 490)/2;
		var y = (screen.availWidth - 660)/2;
		ref = getCookieValue();
		window.open( doGALink('http://webalbum.bonusprint.com/SMGC01/main.aspx?refer=' + ref), null, "top="+x+",left="+y+",height=490,width=660,status=0,scrollbars=0,resizable=0,toolbar=0,menubar=0,titlebar=0;location=0");
	}
// End of special function for the people FREE A5 card //

//Google Analytics code -  Dodec Implementation -START
function doGACall(){

	  pageTracker1 = _gat._getTracker("UA-9075470-5");
	  
	  var hostname = window.location.hostname;
	  if(hostname.indexOf('bonusprint.co.uk') != -1){
		 pageTracker1._setDomainName(".bonusprint.co.uk");
	  }else if(hostname.indexOf('bonusprint.com') != -1){
		 pageTracker1._setDomainName(".bonusprint.com");
	  }else{
	  	pageTracker1._setDomainName("none");
	  }
	 
	  pageTracker1._setAllowLinker(true);
	  pageTracker1._setAllowHash(false);
	  pageTracker1._trackPageview();	
}


function doGARedirect(link){
	checkGAVar();
	 try {

   		  	//pageTracker._trackEvent("Out bound click", link);			
			pageTracker1._link(link);
    		//setTimeout('document.location = "' + link + '"', 100)
	 }catch(err){alert(err);}
}

function doGAPopupCall(link, name, features, type){
	checkGAVar();
	 try {
		
		pageTracker1._trackEvent("Outbound/Popup click", link);
	 }catch(err){alert(err);}
}

function checkGAVar(){
	if(pageTracker1 == null || pageTracker1 =='undefined'){
	 doGACall();
	}
}

function doGALink(link){
	checkGAVar();
	return pageTracker1._getLinkerUrl(link);
}

	var jsref1 = document.createElement('script');
	jsref1.setAttribute("src","http://www.google-analytics.com/ga.js");
	jsref1.setAttribute("type","text/javascript");
	document.getElementsByTagName("head")[0].appendChild(jsref1);

	if (window.attachEvent){
		window.attachEvent("onload", doGACall);			
	}else{
		window.addEventListener("DOMContentLoaded", doGACall, false);
	}


	//Google Analytics code -  Dodec Implementation -END