aLogin='';
aMessages='';
aFriend='';
aCalad='';
aBuddy='';
aMPic='';
noclose=0;
aSCom='';


function opencalendar (id) {
	w = 300;
	h = 350;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	aCal=window.open("/calendar_info.php?cal_id="+id, "calendar_info"+id, "toolbar=no,width="+w+",height="+h+",top=15,left=15,status=yes,scrollbars=yes,resizable=yes,menubar=no");
} // end function openlogin


function openflyerwin (page) {
	w = 300;
	h = 350;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	flyerwin=window.open(page, "flyerwin", "toolbar=no,width="+w+",height="+h+",top=15,left=15,status=yes,scrollbars=yes,resizable=yes,menubar=no");
	flyerwin.focus();
	return false;
} // end function openlogin


function openbuyphotowin (page) {
	w = 800;
	h = 475;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	buyphoto=window.open(page, "buyphoto", "toolbar=no,width="+w+",height="+h+",top=15,left=15,status=yes,scrollbars=yes,resizable=yes,menubar=no");
	buyphoto.focus();
	return false;
} // end function openlogin

function resizeFlyer(wi,hi) {
	wi=wi+80;
	hi=hi+110;
	w = 300;
	h = 350;
	if (wi > w) w = wi;
	if (hi > h) h = hi;
	if (screen.width < w) w = screen.width;
	if (screen.height-110 < h) h = screen.height-110;
	if (w > 300 || h > 350) window.resizeTo(w,h);
	return true;
}  // end function

function clickoverimage(image,image1,image2) {	
	if (image.src==image1) image.src=image2;
	else showflyerdetail(1);
}  // end function

function resizeWin() { 
	if (document.all) { 
		winHeight=document.all['bodyArea'].offsetHeight+70; 
		winWidth=document.all['bodyArea'].offsetWidth+50;
		if (screen.width-110 < winWidth) winWidth = screen.width-110;
		if (screen.height-110 < winHeight) winHeight = screen.height-110; 
		if (winHeight < 350) window.resizeTo(300,winHeight);
	} // end if
	return true;
}  // end function 


function opensalesfaqwin (page) {
	w = 600;
	h = screen.height-110;
	var winl = (screen.width - w) / 2;
	if (h > 800) h = 800;
	aSales=window.open(page, "", "toolbar=no,width="+w+",height="+h+",top=15,left="+winl+",status=yes,scrollbars=yes,resizable=yes,menubar=no");
	return false;
} // end function openlogin

aCalcontrib = '';
function contribaddyourself (calcontrib_id,calendar_id) {	
	if (aCalcontrib && !aCalcontrib.closed) aCalcontrib.close();	
	w = 350;
	h = 350;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	tcomp = calcontrib_id;
	if (calcontrib_id == '-1') tcomp = 0;
	aCalcontrib=window.open('/contrib_addyourself.php?calcontrib_id='+calcontrib_id+'&calendar_id='+calendar_id, "cal"+tcomp+"_con_win", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=yes,resizable=yes,menubar=no,dependent=yes");
	aCalcontrib.focus();
} // end function contribaddyourself

function rbmap(page) {
	w = 444;
	h = screen.height-110;
	if (h > 565) h = 565; 
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - 115 - h) / 2;
	
	window.open(page, "rbmap", "width="+w+",height="+h+",top="+wint+",left="+winl+',status=no,scrollbars=yes,resize=yes,menubar=no');
} // end function editComment


function viewSpotlight(page) {
	w = 680;
	h = screen.height-110;
	if (h > 600) h = 600; 
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - 115 - h) / 2;
	
	window.open(page, "rcnspotlight", "width="+w+",height="+h+",top="+wint+",left="+winl+',status=no,scrollbars=yes,resize=yes,menubar=no');
	return false;
} // end function editComment

function openmenus(page) {
	w = 640;
	h = screen.height-110;
	if (h > 600) h = 600; 
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - 115 - h) / 2;
	
	window.open(page, "rcnmenu", "width="+w+",height="+h+",top="+wint+",left="+winl+',status=no,scrollbars=yes,resize=yes,menubar=no');
	return false;
} // end function editComment

function membership(page) {
	w = screen.width-10;
	h = screen.height-120; 
	if (w > 600) w = 600; 
	if (h > 565) h = 565; 
	var winl = 10;
	var wint = 10;
	
	window.open(page, "rcnmember", "width="+w+",height="+h+",top="+wint+",left="+winl+',status=no,scrollbars=yes,resize=yes,menubar=no');
} // end function editComment

function addnewscomm(page) {
	w = 444;
	h = screen.height-110;
	if (h > 565) h = 565; 
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	window.open(page, '', "width="+w+",height="+h+",top="+wint+",left="+winl+',status=no,scrollbars=yes,resize=yes,menubar=no');
	return false;
} // end function editComment


function openlogin (page) {
	if (aLogin && !aLogin.closed) aLogin.close();
	w = 400;
	h = 425;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	login_win=window.open(page, "login_win", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=no,resize=no,menubar=no");
	login_win.focus();
	return false;
} // end function openlogin

aJoin= '';
function openjoin (page) {
	if (aJoin && !aJoin.closed) aJoin.close();
	w = 450;
	h = screen.height-110;
	if (h > 650) h = 650; 
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	join_win=window.open(page, "join_win", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=no,resize=no,menubar=no");
	join_win.focus();
	return false;
} // end function openlogin

function openbuddy () {
	if (aBuddy && !aBuddy.closed) aBuddy.close();	
	w = 162;
	h = 135;
	var winl = (screen.width - w)-50;
	var wint = (screen.height - h) - 150;
	aBuddy=window.open('/realbuddy.php', "buddy_win", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=no,resize=no,menubar=no");
} // end function openbuddy

function openflyerad () {
	w = 400;
	h = 400;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	aCalad=window.open ('virtual_flyer.php', 'newWin', 'scrollbars=auto,status=no,width=500,height=500,resizable=yes');
} // end function openflyerad

function openbusinessadmin (section) {	
	w = 650;
	h = 550;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	aBusAd=window.open('/business/login.php?sect='+section, "business_admin", "scrollbars=yes,toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,resize=no,menubar=no");
} // end function openbusinessadmin

function openmessages(whichpage) {
	if (aMessages && !aMessages.closed) aMessages.close();	
	if (whichpage == 'inbox') {
		mypage = '/messagecentre.php';
	} else {
		mypage = '/msg_read.php';
	} // end if
	w = 450;
	h = 425;
	var winl = 50;
	var wint = 50;	
	aMessages=window.open(mypage, "rb_messages", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=yes,resize=yes,menubar=no");
	if (window.name == 'buddy_win') window.location.reload();
} // end function openlogin

function openfriendspot(photo) {
	if (aFriend && !aFriend.closed) aFriend.close();	
	mypage = '/friend_spotter.php?pid='+photo;	
	w = 275;
	h = 480;
	var winl = 150;
	var wint = 150;	
	aFriend=window.open(mypage, "rb_friendspotter", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=yes,resize=yes,menubar=no");
} // end function openlogin

function selectmainpic(photo) {
	if (aMPic && !aMPic.closed) aMPic.close();	
	mypage = '/user_newmain.php?pid='+photo;	
	w = 400;
	h = 400;
	var winl = 50;
	var wint = 50;	
	aMPic=window.open(mypage, "rb_mainpic", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=yes,resize=yes,menubar=no");
} // end function openlogin

function addstorycomment(story) {
	if (aSCom && !aSCom.closed) aSCom.close();	
	mypage = '/story_comment_add.php?sid='+story;	
	w = 400;
	h = 400;
	var winl = 50;
	var wint = 50;	
	aSCom=window.open(mypage, "rb_storycom", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=yes,resize=yes,menubar=no");
} // end function openlogin

function rbfunct(thepage) {
	w = 250;
	h = 150;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;	
	aMessages=window.open(thepage, "rb_funct", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=no,resize=no,menubar=no");
} // end function openlogin

gbfCalendardl = '';
function addmajorevent (page) {	
	if (gbfCalendardl && !gbfCalendardl.closed) gbfCalendardl.close();	
	w = 600;
	h = screen.height-110;
	if (h > 480) h = 480; 
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - 115 - h) / 2;
	gbfCalendardl=window.open(page, "gbfcal_cdl_win", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=yes,resizable=yes,menubar=no,dependent=yes");
	gbfCalendardl.focus();
} // end function login

function sendmessage() {
	w = 400;
	h = 425;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;	
	aMessages=window.open("", "rb_messagesend", "toolbar=no,width="+w+",height="+h+",top="+wint+",left="+winl+",status=no,scrollbars=no,resize=no,menubar=no");
} // end function openlogin

function winunload () {
	if (aFriend && !aFriend.closed) aFriend.close();	
	if (aMPic && !aMPic.closed) aMPic.close();
	return true;
} // end function winunload

function pt(qs) {
w=window.open("http://uk.partners.pocketthis.com/ptl2.pt?" + qs,"send2mymobile","width=320,height=480,resizable=yes,scrollbars=no" + (screen ? ",top=30,left=" + (screen.availWidth - 350) + ",screenY=30,screenX=" + (screen.availWidth - 350) : ""));
w.focus();
}

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_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_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(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_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

var detailWin = null;

function opendetailpopup( venue )
{
	if (detailWin && !detailWin.closed && detailWin.location)
	{
 		detailWin.location.href = venue;
	}
	else
	{
		detailWin = window.open (venue , "detail", "scrollbars=yes,status=no,width=300,height=275,resizable=yes");
	}
	// set the focus to this window, if the broswer supports this method
	if( window.focus )
	{
 		detailWin.focus();
	}
} // end function opendetailpopup


sfHover = function() {
	var sfEls = document.getElementById("nav_list").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

/****** Image Roatate ******/
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage(\'"+place+"\')";
setTimeout(recur_call, interval);
}