
function rusure() { 
	if (confirm("Are you sure You want to Delete?")) { 
		return true; 
	} else { 
		return false;
	} 
} 

function isrestore(id) { 
	if (confirm("Restore File : "+id+".html")) { 
		return true; 
	} else { 
		return false;
	} 
} 

function Save() 

	{
  	Form1.infoDetail1.value = idContent.document.body.innerHTML;
  	Form1.submit();
	}

var displayMode = "RICH"
function setDisplayMode() 
	{
	if(displayMode=='RICH')
		{
		idContent.document.body.clearAttributes;
		idContent.document.body.style.fontFamily = 'MS Sans Serif';
		idContent.document.body.style.fontSize = '14px';
		idContent.document.body.innerText = idContent.document.body.innerHTML;
		idContent.document.body.innerHTML = "" + idContent.document.body.innerHTML + ""
		displayMode = 'HTML';
		idToolbar.style.display = "none"
		} 
	else 
		{
		idContent.document.body.clearAttributes;
		idContent.document.body.style.fontFamily = '';
		idContent.document.body.style.fontSize = '';
		idContent.document.body.innerHTML = idContent.document.body.innerText;
		displayMode = 'RICH';
		idToolbar.style.display = "block"
		}
	}
function GetElement(oElement,sMatchTag) 
	{
	while (oElement!=null && oElement.tagName!=sMatchTag) 
		{
		if(oElement.id=="idContent") return null;
		oElement = oElement.parentElement
		}
	return oElement
	}


function FormatText(command, option){
	
  	frames.idContent.document.execCommand(command, true, option);
  	frames.idContent.focus();
}

function AddImage(){	
	imagePath = prompt('Enter the web address of the image', 'http://');				
	
	if ((imagePath != null) && (imagePath != "")){					
		frames.idContent.document.execCommand('InsertImage', false, imagePath);
  		frames.idContent.focus();
	}
	frames.idContent.focus();			
}

function AddSmileyIcon(imagePath){	
									
	frames.idContent.document.execCommand('InsertImage', false, imagePath);
  	frames.idContent.focus();			
}

function showNewColor(idChang) {

		var newColor = idChang;

		if((document.getElementById)&& (document.getElementById('tagID')!=null)) {

			var myElement = document.getElementById('tagID');

		 	if ((myElement.style)&& (myElement.style.backgroundColor!=null)) {

			    if(myElement.style.backgroundColor == 'white'){

					document.getElementById('tagID').style.backgroundColor = newColor;

				}else {

					document.getElementById('tagID').style.backgroundColor = newColor;      
    			}

  			}else {	

				return;

  			}

		}else {

		  return;

		}

	}
	
	
function showColorBox(idChang) {

		var newColor = idChang;

		if((document.getElementById)&& (document.getElementById('tagID2')!=null)) {

			var myElement = document.getElementById('tagID2');

		 	if ((myElement.style)&& (myElement.style.backgroundColor!=null)) {

			    if(myElement.style.backgroundColor == 'white'){

					document.getElementById('tagID2').style.backgroundColor = newColor;

				}else {

					document.getElementById('tagID2').style.backgroundColor = newColor;      
    			}

  			}else {	

				return;

  			}

		}else {

		  return;

		}

	}


function CheckForm() {
	
var email=document.SaveForm.YourMail.value;
if (email==""){
alert("Please type your Email")
document.SaveForm.YourMail.focus()
return false
	}
	
	if (document.SaveForm.textName.value == ""){
		alert("Please type your Name");
		document.SaveForm.textName.focus();
		return false;
	}

	
	
	return true
}

function addicon(what)
{
	frames.idContent.focus();
	frames.idContent.document.execCommand('InsertImage', false, what);
}


function _reg() {
window.open('./_infoboard5/isuser.php', '', "scrollbars=no,width=500,height=400");
}

function _gen() {
window.open('./_infoboard5/isuser.php?get=gen', '', "scrollbars=no,width=500,height=400");
}

function _forget() {
window.open('./_infoboard5/isuser.php?get=forget', '', "scrollbars=no,width=500,height=400");
}

function _admin() {
window.open('./_infoboard5/isadmin.php?get=admin', '', "scrollbars=yes,width=500,height=400");
}

function _user() {
window.open('./_infoboard5/isadmin.php?get=user', '', "scrollbars=yes,width=500,height=400");
}

function _member() {
window.open('./_infoboard5/isuser.php?get=mem', '', "scrollbars=no,width=500,height=400");
}

function idcard(id,i) {
window.open("./_infoboard5/isuser.php?"+"id="+id+"&get=profile&sel="+i,"Newwin1_"+id,"scrollbars=no,width=500,height=400");
}

//var mikExp = /[\/\'\"\:\;\,\\.?\|\<\>$\\@\\\#%\^\&\*\(\)\[\]\+\{\}\`\~\=\|]/;
var mikExp = /[\/\'\"\:\;\,\?\|\<\>$\\@\\\#%\^\&\*\(\)\[\]\+\{\}\`\~\=\|]/;
function dodacheck(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mikExp) != -1) {
var tst = val.value.substring(0, (strLength) - 1);
val.value = tst;
   }
}
function doanothercheck(form) {
if(form.value.length < 1) {
alert('Please enter something.');
return false;
}
if(form.value.search(mikExp) == -1) {
alert('Correct Input');
return false;
}
else {
alert('Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n');
form.select();
form.focus();
return false;
}
alert('Correct Input');
return false;
}


function openDir( form ) { 

	var newIndex = form.catid.selectedIndex; 
		cururl = form.catid.options[ newIndex ].value; 

		window.location.assign( cururl ); 
} 






function JSAll() {
	this.objects=new Object(); this.unique=new Unique(); this.register=JSAll_register; this.clobberUID=JSAll_clobberUID;
	function JSAll_register(oObject) {
		if (!this.objects[oObject.oType]) { this.objects[oObject.oType]=new Array(); }
		regUID = this.unique.get(oObject.oType);
		if (oObject.oID!='') {
			for (var si in this.objects) {
				if (this.objects[si][oObject.oID]) { delete this.objects[si][oObject.oID]; this.objects[si][regUID]=oObject; }
			}
		}
		this.objects[oObject.oType][regUID]=oObject; return regUID;
	}
	function JSAll_clobberUID(oObject) {
		for (var si in this.objects) {
			for (var sObject in this.objects[si]) {
				if (this.objects[si][sObject]!=null) { if (this.objects[si][sObject].oID==oObject.oID) { delete this.objects[si][sObject]; } }
			}
		}
	}
}
function Unique() {
	var o = new Object();
	o.m_nVal = 0; o.m_nUnique = Unique.nUnique++; o.get = Unique_get; o.hexval = Unique_hexval; return o;
	function Unique_get(sType) {
		var rVal = new String();
		var newVal = new String();
		for (i = 0; i < sType.length; i++) { newVal += this.hexval(sType.charCodeAt(i)-65); }
		newVal = newVal.substring(0,24);
		for (i=newVal.length-1; i<=22; i++) { newVal="0"+newVal; }
		for (i=0; i<newVal.length; i+=6) { rVal += newVal.substring(i,i+6)+"_";	}
		rVal += this.hexval(65+(this.m_nVal%26))+this.hexval(this.m_nUnique)+"_"+this.hexval(this.m_nVal++);
		return rVal;
	}
	function Unique_hexval(c) { return String("0123456789ABCDEF").charAt((c/16)&0x0F)+String("0123456789ABCDEF").charAt((c/1)&0x0F); }
}
Unique.nUnique = 1;
function JSObj() {
	this.oType=new String("JSObj"); this.oID=new String();this.last_error= new String();this.create=JSObj_create;this.destroy=JSObj_destroy;
	function JSObj_create() { this.oID = jsAll.register(this); }
	function JSObj_destroy() { jsAll.clobberUID(this); }
}
function isIE() {
	var rVal = false;
	try {
		var oDOM = new ActiveXObject("Microsoft.XMLDOM");
		if ((document.all) && (oDOM)) { rVal = true; oDOM = null; }
	} catch(ex) { if (disable_debug_handler == true) { debug(ex); } }
	return rVal;
}
function isNS() {
	var rVal = false;
	try {
		var oNodes = document.getElementsByTagName("A");
		if (oNodes) {
			rVal = true;
			oNodes = null;
		}
	} catch(ex) { if (disable_debug_handler == true) { debug(ex); } }
	return rVal;
}
function addLinkBehaviors() {
	if (isIE()) {
		var oLinks=document.getElementsByTagName("A");
		var nLinkLen=oLinks.length; var si = 0;
		var sAttrib = "";
		while (si < nLinkLen) {
			if (oLinks[si].getAttribute("isData") == "true") {
				if (isIE()) {
					oDataA[oDataA.length] = oLinks[si];
				}
			} else if (oLinks[si].getAttribute("isRollover") == "true") {
				oLinks[si].bh=new LinkBehavior(oLinks[si], oDataA.length-1);
			}
			si++;
		}
	}
}
function hideall() { if (isIE()) { try { if ((jsAll) && (jsAll.objects) && (jsAll.objects['ContentObj'])) { var oObjs = jsAll.objects['ContentObj']; if (oObjs) { for (i in oObjs) { if (oObjs[i]) { oObjs[i].hide(); }}}}} catch(ex) { if (disable_debug_handler == true) { debug(ex); }}}}
function window_onunload() { try { for (var si in jsAll.objects) { for (var si2 in jsAll.objects[si]) { jsAll.objects[si][si2].destroy();} } CollectGarbage(); } catch(ex) { if (disable_debug_handler == true) { debug(ex); } } }
function window_onscroll() { hideall(); }

function XSL_load() {
	if ((!this.xml) && (!this.bLoading)) {
		try {
			this.bLoading = true;
			this.createXMLObject();
			this.object.load(this.url);
		} catch(ex) {
			if (disable_debug_handler == true) {
				debug(ex);
			}
		}
	} else {
		// already have data
	}
}
function debug(oError) {
	var oCaller = debug.caller.toString();
	oCaller = oCaller.substring(oCaller.indexOf(" "), oCaller.indexOf("{"));
	var sStr = "In function " + oCaller + " :\n" + oError.message + "\n";
	for (var i in oError)
	{
		sStr += i + ": " + oError[i].toString() + "\n";
	}
	//alert(sStr);

}

// list of images to preload
//
function PreloadImages()
{
	if (aImages[nIncr])
	{
		var oImg = new Image();
		oImg.src = sBaseUrl + aImages[nIncr++];
		setTimeout("PreloadImages()", 5);
	}

}

function parseXPath(oXMLDoc, sXPath)
{
        // if the doc hasn't been parsed correctly, or is invalid
        if (oXMLDoc)
        {
                if (!oXMLDoc.parsed)
                {
                        // document wasn't parsed (invalid xml?)
                        return null;
                }
        } else {
                // xmldocument doesn't exist (check referring function)
                return null;
        }
        var oNode;
        var aReturn             = new Array();                                          // used if we return a collection
        var nItems              = 0;                                                            // counter used when iterating through attributes
        var oNodeList   = oXMLDoc.selectNodes(sXPath);          // apply xpath against xml doc

        if (oNodeList.length == 0)
        {
                // invalid xpath or no nodes matched
                return "";
        }

        var oItems                      = new Enumerator(oNodeList);    // iterate through nodes
        var oItem                       = null;                                                 // used as the current element in the Enumeration
        var oAttributes         = null;                                                 // so that we can gather attribute collection
        // step through each node
        var nCount = 0;
        for (oItems.moveFirst(); !oItems.atEnd(); oItems.moveNext())
        {
                oItem = oItems.item();  // current item - assigned for performance reasons
                if (oItem.attributes)
                {
                        // step through attributes and assign to an array
                        oAttributes = new Enumerator(oItem.attributes);
                        aReturn[nItems] = new Object();
                        var count = 0;  // count the number of attributes

                        for (oAttributes.moveFirst(); !oAttributes.atEnd(); oAttributes.moveNext())
                        {
                                count++;
                                oAttribute = oAttributes.item();
                                aReturn[nItems][oAttribute.name.toLowerCase()] = oAttribute.value;
                        }
                        if ((count == 0) && (oItem.text != ""))
                        {
                                // item is a text node without attributes. (CDATA section)
                                return oItem.text;
                        }
                } else {
                        // text attribute
                        return oItem.text;
                }
                nItems++;
        }
        // return object
        return aReturn;
}
function formatComma(sStr)
{
	var sInStr = new String(sStr);
	var aThrees = new Array();
	for (var i = sInStr.length; i>0; i-=3)
	{
		aThrees[aThrees.length] = sInStr.substring(((i-3 > 0) ? i-3 : 0),i);
	}
	return aThrees.reverse().join(",");
}

function implement(cInterface, oObj) {
        var oInst = new cInterface();
        for (i in oInst) {
                oObj[i] = oInst[i];
        }
}


function getObjRef(oObj) {
	return "jsAll.objects."+oObj.oType+"['"+oObj.oID+"']";
}









function SwapGroup() {
	var o = new JSObj();
	o.oType = "SwapGroup";
	o._list = new Array();
	o.add = SwapGroup_add;
	o.getList = SwapGroup_getList;
	o.create();
	return o;
	
	function SwapGroup_add(oSwappable) {
		this._list[oSwappable.oID] = oSwappable;
		oSwappable.swapGroup = this;
	}

	function SwapGroup_getList() {
		return this._list;
	}
}

function Swappable() {
	this.setOn = Swappable_setOn;
	this.setOff = Swappable_setOff;
	this.setActive = new Function();
	function Swappable_setOn() { this.setActive(true); }
	function Swappable_setOff() { this.setActive(false); }
}

function SwappableDiv(oDiv, oButton, sStyle) {
	var o = new JSObj();
	o.oType = "SwappableDiv";
	implement(Swappable, o);
	o.onclick = SwappableDiv_onclick;
	o.setActive = SwappableDiv_setActive;
	o.setButtonActive = SwappableDiv_setButtonActive;
	o.swapGroup = null;
	o.button = oButton;
	o.button.setAttribute("listener",o);
	o.div = oDiv;
	o.style = sStyle;
	o.create();
	// needs to occur after create.
	o.button.onclick = getEventHandler(o, "onclick");
		
	return o;

	function SwappableDiv_onclick() {
		var oSwappables = this.swapGroup.getList();

		for (var i in oSwappables) {
			if (i != this.oID) {
				oSwappables[i].setOff();
			} else {
				oSwappables[i].setOn();
			}
		}
	}
	function SwappableDiv_setButtonActive(bActive) {
		if (bActive) {
			this.button.className=this.style + "Active";
			this.button.childNodes.item(0).style.color = "#ffffff";
		} else {
			this.button.className=this.style;
			this.button.childNodes.item(0).style.color = "";
		}
	}
	function SwappableDiv_setActive(bActive) {
		this.setButtonActive(bActive);
		var sStyle = bActive ? "" : "none";
		this.active = bActive;
		this.div.style.display = sStyle;
	}
}

function SwappableCompactDiv(aDivArray, oButton, sStyle) {
	var o = new SwappableDiv(null, oButton, sStyle);
	o._setActive = o.setActive;
	o.divArray = aDivArray;
	o.setActive = SwappableCompactDiv_setActive;
	return o;
		function SwappableCompactDiv_setActive(bActive) {
		var sStyle = bActive ? "" : "none";
		this.active = bActive;
		for (var i = 0; i < this.divArray.length; i++) {
			this.divArray[i].style.display = sStyle;
		}
		this.setButtonActive(bActive);
	}
}

function getEventHandler(oObj, sEvent) {
	var fName = oObj.oType + "_" + oObj.oID + "_" + sEvent;
	eval("function " + fName + "() { " + getObjRef(oObj) + "." + sEvent + "(); }");
	return eval(fName);
}
