/*
+------------------------------------------------
|	Invision Power Board v1.3 Final
|	========================================
|	by Matthew Mecham
|	(c) 2001 - 2003 Invision Power Services
|	http://www.invisionpower.com
|   ========================================
|	Web: http://www.invisionboard.com
|	Email: matt@invisionpower.com
|   Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|	> Main javascript module
|	> Module Version Number: 1.2.3.0
+--------------------------------------------------------------------------
*/

//-------------------------
// Spoiler BB Code
//-------------------------

function OpenSpoiler(id) {
	var obj = "";
	var img = "";

	if (document.getElementById) {
		obj = document.getElementById(id).style;
		img = document.getElementById(id+'img');
	} else if (document.all) {
		obj = document.all[id];
		img = document.all[id+'img'];
	} else if (document.layers) {
		obj = document.layers[id];
		img = document.layers[id+'img'];
	} else {
		return 1;
	}	

	if (obj.display == "") {
		obj.display = "none";
		img.src = "./html/sys-img/icon_plus.gif";
	} else if (obj.display != "none") {
		obj.display = "none";
		img.src = "./html/sys-img/icon_plus.gif";
	} else {
		obj.display = "block";
		img.src = "./html/sys-img/icon_minus.gif";
	}	
}

//-------------------------
// Collect posts for mods
//-------------------------

function collect_pidz() {
	for (i=0; i<document.collect.length; i++) {
		if (document.collect[i].name.indexOf('pozt')!=-1) {
			var ne=document.createElement("input");
			ne.name=document.collect[i].name;
			ne.type='hidden';
			if (document.collect[i].checked.toString()=='true') { 
				ne.value=1; 
			} else { 
				ne.value=0;
			}
			document.modform.appendChild(ne);
		}
	}
}

//-------------------------
// Tabs in user profile
//-------------------------

function stat_user() {
	if(document.getElementById('stat_user').style.display == 'none'){
		document.getElementById('stat_user').style.display = 'block';
		document.getElementById('communication_user').style.display = 'none';
		document.getElementById('profile_user').style.display = 'none';
		document.getElementById('pul').className = 'pp-taboff';
		document.getElementById('cul').className = 'pp-taboff';
		document.getElementById('sul').className = 'pp-tabon';
	}
}
function communication_user() {
	if(document.getElementById('communication_user').style.display == 'none'){
		document.getElementById('communication_user').style.display = 'block';
		document.getElementById('stat_user').style.display = 'none';
		document.getElementById('profile_user').style.display = 'none';	
		document.getElementById('pul').className = 'pp-taboff';
		document.getElementById('cul').className = 'pp-tabon';
		document.getElementById('sul').className = 'pp-taboff';
	}
}
function profile_user() {
	if(document.getElementById('profile_user').style.display == 'none'){
		document.getElementById('profile_user').style.display = 'block';
		document.getElementById('stat_user').style.display = 'none';
		document.getElementById('communication_user').style.display = 'none';
		document.getElementById('pul').className = 'pp-tabon';
		document.getElementById('cul').className = 'pp-taboff';
		document.getElementById('sul').className = 'pp-taboff';
	}
}

//-------------------------
// PopUp window (new PM)
//-------------------------

function PopUp(url, name, width,height,center,resize,scroll,posleft,postop) {
	if (posleft != 0) { x = posleft }
	if (postop  != 0) { y = postop  }

	if (!scroll) { scroll = 1 }
	if (!resize) { resize = 1 }

	if ((parseInt (navigator.appVersion) >= 4 ) && (center)) {
		X = (screen.width  - width ) / 2;
		Y = (screen.height - height) / 2;
	}
	if (scroll != 0) { scroll = 1 }

	var Win = window.open( url, name, 'width='+width+',height='+height+',top='+Y+',left='+X+',resizable='+resize+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no');
}

//-------------------------
// Insert username in qr
//-------------------------

function ins(name){
	if (document.REPLIER) {
		var input=document.REPLIER.Post;
		input.value=input.value+"[b]"+name+"[/b],"+" \n";
	}
}

//-------------------------
// Toggle cats on index
//-------------------------

function ShowHide(id1, id2) {
	if (id1 != '') expMenu(id1);
	if (id2 != '') expMenu(id2);
}
 
function expMenu(id) {
	var itm = null;
	
	if (document.getElementById) {
		itm = document.getElementById(id);
	} else if (document.all) {
		itm = document.all[id];
	} else if (document.layers) {
		itm = document.layers[id];
	}
   
	if (!itm) {
	} else if (itm.style) {
		if (itm.style.display == "none") { 
			itm.style.display = "block"; 
			document.cookie=id + "=block; path=/; expires=Mon, 01-Jan-2020 00:00:00 GMT";
		} else { 
			itm.style.display = "none";
			document.cookie=id + "=none; path=/; expires=Mon, 01-Jan-2020 00:00:00 GMT";
		}
	} else { 
		itm.visibility = "show";
	}
}
