/*
 * tb.js
 */

var noteWin = null;


function jLO() {
	var url = "document.location='http://www.topbear.com'";
	$.get('/members/member.php', {srv: 'logout'});
	setTimeout(url, 1000);
}

function jLI() { 
	$.post('/a.php', $('#liform').serialize() , 
        function(data){ 
		    document.location = data;
		}
	);	
}


function exitIT() {                                                         
	window.close();                                        
}        
function exitNjump(newloc) {
	opener.location = newloc ;
	window.close();                                        
}                                                 
function exitNclean() {
	opener.location.reload();
	window.close();
}

function jMsg(url) {
	  var flags = 'toolbar=no,location=no,directories=no,' +
	              'status=no,menubar=no,resizable=yes,copyhistory=no,' +
	              'scrollbars=yes,width=500,height=430';
	  noteWin = window.open(' ', 'msgManager', flags);
	  var fullURL = '/members/' + url; 
	  noteWin.location = fullURL;
	  noteWin.focus();
}

function notifyMsgMgr() {
	  alert ('You have new Messages!');
	  if (noteWin && !noteWin.closed ) {
	    if (noteWin.location.search.indexOf('mngnotes'))
	    	noteWin.refreshManager();
	  }
}



function jPop(url, popname, w, h) {
	var flags = 'toolbar=no,location=no,directories=no,' +
	            'status=no,menubar=no,resizable=yes,copyhistory=no,' +
	            'left=50,screenX=50,top=50,screenY=50,scrollbars=yes,' +
	            'width=' + w + ',height=' + h;
	var viewKey = window.open(' ', popname, flags);
	var fullURL = '/members/' + url;
	viewKey.creator = window;
	viewKey.location = fullURL;
	viewKey.focus();
}  

function insertLocation(Region, State, City, TR, TS, TC, re) {
	if (re == 'yes') {
		location.reload();
	} else {
		var alertstring = TR+ " " +TS+ " " +TC+ " ";
		document.userform.locbutt.value = alertstring;
		document.userform.region_code.value = Region;
		document.userform.state_code.value = State;
		document.userform.city_code.value = City;
	}
}                                                        

function insertSearchLocation(Region, State, City, TR, TS, TC, re) {
	if (re == 'yes') {
		location.reload();
	} else {
		var alertstring = TR+ " " +TS+ " " +TC+ " ";
		document.srchform.locbutt.value = alertstring;
		document.srchform.region_code.value = Region;
		document.srchform.state_code.value = State;
		document.srchform.city_code.value = City;
	}
} 

function insertEventLocation(Region, State, City, TR, TS, TC, re) {
	if (re == 'yes') {
		location.reload();
	} else {
		var alertstring = TR+ " " +TS+ " " +TC+ " ";
		document.evform.locbutt.value = alertstring;
		document.evform.region_code.value = Region;
		document.evform.state_code.value = State;
		document.evform.city_code.value = City;
	}
} 

function insertEvEditLocation(Region, State, City, TR, TS, TC, re) {
	if (re == 'yes') {
		location.reload();
	} else {
		var alertstring = TR+ " " +TS+ " " +TC+ " ";
		document.evedit.locbutt.value = alertstring;
		document.evedit.region_code.value = Region;
		document.evedit.state_code.value = State;
		document.evedit.city_code.value = City;
	}
} 

function savePwd(objId) {
	$.post('/a.php', $('#pwform').serialize() , 
			function(data){ 
				$(objId).html(data);
			}
	);

}

function saveEml(objId) {
	$.post('/a.php', $('#emlform').serialize() , 
			function(data){ 
				$(objId).html(data);
			}
	);

}

function saveNick(objId) {
	$.post('/a.php', $('#nickform').serialize() , 
			function(data){ 
				$(objId).html(data);
			}
	);

}

function saveItem(form, objId) {
	//alert("form:"+form+ "   objId:"+objId);
	$.post('/a.php', $('#'+form).serialize() , 
			function(data){ 
				$(objId).html(data);
			}
	);		
}
 
function savePics(form, objId) {
	//alert("form:"+form+ "   objId:"+objId);
	$.post('/a.php', $('#'+form).serialize() , 
			function(data){ 
				$('#'+objId).html(data);
			}
	);			
}
 
function postItem(form, objId) { 
	$.post('/members/click.php', $('#'+form).serialize() , 
			function(data){ 
				$('#'+objId).html(data);
			}
	);		
}




/*
Form field Limiter script- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/
 
var ns6=document.getElementById&&!document.all
 
function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}
 
function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}
 
function displaylimit(theform,thelimit){
var limit_text='<br><b><span id="'+theform.toString()+'">'+thelimit+'</span></b> characters remaining'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}

 
/*
Form field Limiter script- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}

function displaylimit(theform,thelimit){
var limit_text='<br><b><span id="'+theform.toString()+'">'+thelimit+'</span></b> characters remaining'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}
 
 
// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 620;
defaultHeight = 720;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = false;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(300,300);');
writeln('width=300-(document.body.clientWidth-document.images[0].width);');
writeln('height=300-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}} 



