
/*------------------------------------------------------------------------------------------------------------------------------------------
START FLASH DETECT
------------------------------------------------------------------------------------------------------------------------------------------*/
var FlashDetect = new function(){
	var self = this;
	self.installed = false;
	self.raw = "";
	self.major = -1;
	self.minor = -1;
	self.revision = -1;
	self.revisionStr = "";
	var activeXDetectRules = [
		{
			"name":"ShockwaveFlash.ShockwaveFlash.7",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash.6",
			"version":function(obj){
				var version = "6,0,21";
				try{
					obj.AllowScriptAccess = "always";
					version = getActiveXVersion(obj);
				}catch(err){}
				return version;
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		}
	];
	var getActiveXVersion = function(activeXObj){
		var version = -1;
		try{
			version = activeXObj.GetVariable("$version");
		}catch(err){}
		return version;
	};
	var getActiveXObject = function(name){
		var obj = -1;
		try{
			obj = new ActiveXObject(name);
		}catch(err){}
		return obj;
	};
	var parseActiveXVersion = function(str){
		var versionArray = str.split(",");//replace with regex
		return {
			"raw":str,
			"major":parseInt(versionArray[0].split(" ")[1], 10),
			"minor":parseInt(versionArray[1], 10),
			"revision":parseInt(versionArray[2], 10),
			"revisionStr":versionArray[2]
		};
	};
	var parseStandardVersion = function(str){
		var descParts = str.split(/ +/);
		var majorMinor = descParts[2].split(/\./);
		var revisionStr = descParts[3];
		return {
			"raw":str,
			"major":parseInt(majorMinor[0], 10),
			"minor":parseInt(majorMinor[1], 10), 
			"revisionStr":revisionStr,
			"revision":parseRevisionStrToInt(revisionStr)
		};
	};
	var parseRevisionStrToInt = function(str){
		return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
	};
	self.majorAtLeast = function(version){
		return self.major >= version;
	};
	self.FlashDetect = function(){
		if(navigator.plugins && navigator.plugins.length>0){
			var type = 'application/x-shockwave-flash';
			var mimeTypes = navigator.mimeTypes;
			if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
				var version = mimeTypes[type].enabledPlugin.description;
				var versionObj = parseStandardVersion(version);
				self.raw = versionObj.raw;
				self.major = versionObj.major;
				self.minor = versionObj.minor; 
				self.revisionStr = versionObj.revisionStr;
				self.revision = versionObj.revision;
				self.installed = true;
			}
		}else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
			var version = -1;
			for(var i=0; i<activeXDetectRules.length && version==-1; i++){
				var obj = getActiveXObject(activeXDetectRules[i].name);
				if(typeof obj == "object"){
					self.installed = true;
					version = activeXDetectRules[i].version(obj);
					if(version!=-1){
						var versionObj = parseActiveXVersion(version);
						self.raw = versionObj.raw;
						self.major = versionObj.major;
						self.minor = versionObj.minor; 
						self.revision = versionObj.revision;
						self.revisionStr = versionObj.revisionStr;
					}
				}
			}
		}
	}();
};
FlashDetect.release = "1.0.3";
/*------------------------------------------------------------------------------------------------------------------------------------------
END FLASH DETECT
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START MAKE CALL 2
------------------------------------------------------------------------------------------------------------------------------------------*/
<!--
    function thisMovie(movieName) {
        var isIE = navigator.appName.indexOf("Microsoft") != -1;
        return (isIE) ? window[movieName] : document[movieName];
    }

    function makeCall(str) {
		thisMovie("myMovie").asFunc(str);
    }

    function jsFunc(str) {      
		document.getElementById('testing').style.zIndex = 1000;	
		makeCall("test");		
    }

    function js_Func(str) {      
	    document.getElementById('testing').style.zIndex = -1;
    }
// -->
/*------------------------------------------------------------------------------------------------------------------------------------------
END MAKE CALL 2
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START AJAX
------------------------------------------------------------------------------------------------------------------------------------------*/
function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;

						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;

							if (self.execute) {
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200") {
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}
/*------------------------------------------------------------------------------------------------------------------------------------------
END AJAX
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START AJAX TABS
------------------------------------------------------------------------------------------------------------------------------------------*/
var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadstatustext="<img src='/images/web/loading.gif' /> Requesting content..."

var loadedobjects=""
var defaultcontentarray=new Object()
var bustcacheparameter=""

function ajaxpage(url, containerid, targetobj){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
var ullist=targetobj.parentNode.parentNode.getElementsByTagName("li")
for (var i=0; i<ullist.length; i++)
ullist[i].className=""  //deselect all tabs
targetobj.parentNode.className="selected"  //highlight currently clicked on tab
if (url.indexOf("#default")!=-1){ //if simply show default content within container (verus fetch it via ajax)
document.getElementById(containerid).innerHTML=defaultcontentarray[containerid]
return
}
document.getElementById(containerid).innerHTML=loadstatustext
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(revattribute){
if (revattribute!=null && revattribute!=""){ //if "rev" attribute is defined (load external .js or .css files)
var objectlist=revattribute.split(/\s*,\s*/) //split the files and store as array
for (var i=0; i<objectlist.length; i++){
var file=objectlist[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
}

function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)
var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
if (thetab.getAttribute("rel")){
ajaxpage(thetab.getAttribute("href"), thetab.getAttribute("rel"), thetab)
loadobjs(thetab.getAttribute("rev"))
}
}

function savedefaultcontent(contentid){// save default ajax tab content
if (typeof defaultcontentarray[contentid]=="undefined") //if default content hasn't already been saved
defaultcontentarray[contentid]=document.getElementById(contentid).innerHTML
}

function startajaxtabs(){
for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
var ulobj=document.getElementById(arguments[i])
var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
for (var x=0; x<ulist.length; x++){ //loop through each LI element
var ulistlink=ulist[x].getElementsByTagName("a")[0]
if (ulistlink.getAttribute("rel")){
var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")
ulistlink.setAttribute("href", modifiedurl) //replace URL's root domain with dynamic root domain, for ajax security sake
savedefaultcontent(ulistlink.getAttribute("rel")) //save default ajax tab content
ulistlink.onclick=function(){
ajaxpage(this.getAttribute("href"), this.getAttribute("rel"), this)
loadobjs(this.getAttribute("rev"))
return false
}
if (ulist[x].className=="selected"){
ajaxpage(ulistlink.getAttribute("href"), ulistlink.getAttribute("rel"), ulistlink) //auto load currenly selected tab content
loadobjs(ulistlink.getAttribute("rev")) //auto load any accompanying .js and .css files
}
}
}
}
}
/*------------------------------------------------------------------------------------------------------------------------------------------
END AJAX TABS
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START ACTIVE X OBJECT CALL
------------------------------------------------------------------------------------------------------------------------------------------*/
function GetXmlHttpObject()
{
	var xmlHttps=null;
	try
 	{
 		// Firefox, Opera 8.0+, Safari
 		xmlHttps=new XMLHttpRequest();
 	}
	catch (e)
 	{
 		//Internet Explorer
 		try
  		{
  			xmlHttps=new ActiveXObject("Msxml2.XMLHTTP");
  		}
 		catch (e)
  		{
  			xmlHttps=new ActiveXObject("Microsoft.XMLHTTP");
  		}
 	}
	return xmlHttps;
}
/*------------------------------------------------------------------------------------------------------------------------------------------
END ACTIVE X OBJECT CALL
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START AJAX LOADER
------------------------------------------------------------------------------------------------------------------------------------------*/

var xmlHttps

function addtext() {
	var newtext = document.frm_comment.comment.value;
	
	if (document.myform.placement[1].checked) {
		document.myform.outputtext.value = "";
		}
	document.myform.outputtext.value += newtext;
}

function sendData(str, sdata, sdata2)
{	
	var newtext = document.frm_comment.comment.value;
	if(newtext == '')
	{
		alert('- Please Specify a Comment');
	}
	else
	{	
		xmlHttps=GetXmlHttpObject()
		if (xmlHttps==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		var url="process.php";
		url=url+"?"+sdata+"="+str+"&"+sdata2+"="+newtext;
		url=url+"&sid="+Math.random();
		
		xmlHttps.onreadystatechange=stateChanged;
		xmlHttps.open("GET",url,true);
		xmlHttps.send(null);
		
		document.frm_comment.comment.value = '';
	}
}


function showUser(str, sdata)
{	

	xmlHttps=GetXmlHttpObject()
	if (xmlHttps==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	} 
	var url="process.php";
	url=url+"?"+sdata+"="+str;
	url=url+"&sid="+Math.random();
	
	xmlHttps.onreadystatechange=stateChanged;
	xmlHttps.open("GET",url,true);
	xmlHttps.send(null);
}

function sendId(str, sender){

	location.replace('process.php?'+sender+"="+str);
	
	}

function toggle_tabs()
{
  var args = toggle_tabs.arguments.length;
  if (args < 2)
  {
    return false;
  }
  else
  {
    target = document.getElementById(toggle_tabs.arguments[0]);
    target.style.display = "";
    
    for (x = 1; x < toggle_tabs.arguments.length; x++)
    {
      target = document.getElementById(toggle_tabs.arguments[x]);
      target.style.display = "none";
    }
  }
  return false;
}


function stateChanged() 
{ 
	if(xmlHttps.readyState!=4 || xmlHttps.readyState!="complete")
	{
		document.getElementById("txtCatcher").innerHTML = "Loading...<img src='webpics/images/load.gif'>";
	}
	if (xmlHttps.readyState==4 || xmlHttps.readyState=="complete")
 	{ 
 		document.getElementById("txtCatcher").innerHTML=xmlHttps.responseText 
 	} 
}
/*------------------------------------------------------------------------------------------------------------------------------------------
END AJAX LOADER
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START SEARCH
------------------------------------------------------------------------------------------------------------------------------------------*/
// JavaScript Document
function textboxEmpty(txtbox) {
	if(txtbox.value == "")
	{
		alert("Please enter a search keyword!");    
		return false;
    }
    return true;
}
/*------------------------------------------------------------------------------------------------------------------------------------------
END SEARCH
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START SLIDE SHOW
------------------------------------------------------------------------------------------------------------------------------------------*/
function slide(src,link,text,target,attr) {

  this.src = src;

  this.link = link;

  this.text = text;

  this.target = target;

  this.attr = attr;

  if (document.images) {
    this.image = new Image();
  }

  this.loaded = false;

  this.load = function() {
    // This method loads the image for the slide

    if (!document.images) { return; }

    if (!this.loaded) {
      this.image.src = this.src;
      this.loaded = true;
    }
  }

  this.hotlink = function() {

    var mywindow;

    if (!this.link) return;

    if (this.target) {

      if (this.attr) {
        mywindow = window.open(this.link, this.target, this.attr);
  
      } else {
        mywindow = window.open(this.link, this.target);
      }

      if (mywindow && mywindow.focus) mywindow.focus();

    } else {
      location.href = this.link;
    }
  }
}

function slideshow( slideshowname ) {
  this.name = slideshowname;

  this.repeat = true;

  this.prefetch = -1;

  this.image;

  this.textid;

  this.textarea;

  this.timeout = 3000;

  this.slides = new Array();
  this.current = 0;
  this.timeoutid = 0;

  this.add_slide = function(slide) {
  
    var i = this.slides.length;
  
    if (this.prefetch == -1) {
      slide.load();
    }

    this.slides[i] = slide;
  }

  this.play = function(timeout) {
    this.pause();
  
    if (timeout) {
      this.timeout = timeout;
    }
  
    if (typeof this.slides[ this.current ].timeout != 'undefined') {
      timeout = this.slides[ this.current ].timeout;
    } else {
      timeout = this.timeout;
    }

    this.timeoutid = setTimeout( this.name + ".loop()", timeout);
  }

  this.pause = function() {
  
    if (this.timeoutid != 0) {

      clearTimeout(this.timeoutid);
      this.timeoutid = 0;

    }
  }

  this.update = function() {
    if (! this.valid_image()) { return; }
  
    if (typeof this.pre_update_hook == 'function') {
      this.pre_update_hook();
    }

    var slide = this.slides[ this.current ];

    var dofilter = false;
    if (this.image &&
        typeof this.image.filters != 'undefined' &&
        typeof this.image.filters[0] != 'undefined') {

      dofilter = true;

    }

    slide.load();
  
    if (dofilter) {

      if (slide.filter &&
          this.image.style &&
          this.image.style.filter) {

        this.image.style.filter = slide.filter;

      }
      this.image.filters[0].Apply();
    }

    this.image.src = slide.image.src;

    if (dofilter) {
      this.image.filters[0].Play();
    }

    this.display_text();

    if (typeof this.post_update_hook == 'function') {
      this.post_update_hook();
    }

    if (this.prefetch > 0) {

      var next, prev, count;

      next = this.current;
      prev = this.current;
      count = 0;
      do {

        if (++next >= this.slides.length) next = 0;
        if (--prev < 0) prev = this.slides.length - 1;

        this.slides[next].load();
        this.slides[prev].load();

      } while (++count < this.prefetch);
    }
  }

  this.goto_slide = function(n) {
  
    if (n == -1) {
      n = this.slides.length - 1;
    }
  
    if (n < this.slides.length && n >= 0) {
      this.current = n;
    }
  
    this.update();
  }

  this.goto_random_slide = function(include_current) {

    var i;

    if (this.slides.length > 1) {

      do {
        i = Math.floor(Math.random()*this.slides.length);
      } while (i == this.current);
 
      this.goto_slide(i);
    }
  }


  this.next = function() {
    if (this.current < this.slides.length - 1) {
      this.current++;
    } else if (this.repeat) {
      this.current = 0;
    }

    this.update();
  }


  this.previous = function() {
    if (this.current > 0) {
      this.current--;
    } else if (this.repeat) {
      this.current = this.slides.length - 1;
    }
  
    this.update();
  }


  this.shuffle = function() {

    var i, i2, slides_copy, slides_randomized;

    slides_copy = new Array();
    for (i = 0; i < this.slides.length; i++) {
      slides_copy[i] = this.slides[i];
    }

    slides_randomized = new Array();

    do {

      i = Math.floor(Math.random()*slides_copy.length);

      slides_randomized[ slides_randomized.length ] =
        slides_copy[i];

      for (i2 = i + 1; i2 < slides_copy.length; i2++) {
        slides_copy[i2 - 1] = slides_copy[i2];
      }
      slides_copy.length--;

    } while (slides_copy.length);

    this.slides = slides_randomized;
  }


  this.get_text = function() {
  
    return(this.slides[ this.current ].text);
  }


  this.get_all_text = function(before_slide, after_slide) {
  
    all_text = "";
  
    for (i=0; i < this.slides.length; i++) {
  
      slide = this.slides[i];
    
      if (slide.text) {
        all_text += before_slide + slide.text + after_slide;
      }
  
    }
  
    return(all_text);
  }


  this.display_text = function(text) {
  
    if (!text) {
      text = this.slides[ this.current ].text;
    }
  
    if (this.textarea && typeof this.textarea.value != 'undefined') {
      this.textarea.value = text;
    }

    if (this.textid) {

      r = this.getElementById(this.textid);
      if (!r) { return false; }
      if (typeof r.innerHTML == 'undefined') { return false; }

      r.innerHTML = text;
    }
  }


  this.hotlink = function() {
  
    this.slides[ this.current ].hotlink();
  }


  this.save_position = function(cookiename) {
  
    if (!cookiename) {
      cookiename = this.name + '_slideshow';
    }
  
    document.cookie = cookiename + '=' + this.current;
  }


  this.restore_position = function(cookiename) {
  
    if (!cookiename) {
      cookiename = this.name + '_slideshow';
    }
  
    var search = cookiename + "=";
  
    if (document.cookie.length > 0) {
      offset = document.cookie.indexOf(search);
      if (offset != -1) { 
        offset += search.length;
        end = document.cookie.indexOf(";", offset);
        if (end == -1) end = document.cookie.length;
        this.current = parseInt(unescape(document.cookie.substring(offset, end)));
        }
     }
  }


  this.noscript = function() {
  
    $html = "\n";
  
    for (i=0; i < this.slides.length; i++) {
  
      slide = this.slides[i];
  
      $html += '<P>';
  
      if (slide.link) {
        $html += '<a href="' + slide.link + '">';
      }
  
      $html += '<img src="' + slide.src + '" ALT="slideshow image">';
  
      if (slide.link) {
        $html += "<\/a>";
      }
  
      if (slide.text) {
        $html += "<BR>\n" + slide.text;
      }
  
      $html += "<\/P>" + "\n\n";
    }
  
    $html = $html.replace(/\&/g, "&amp;" );
    $html = $html.replace(/</g, "&lt;" );
    $html = $html.replace(/>/g, "&gt;" );
  
    return('<pre>' + $html + '</pre>');
  }


  this.loop = function() {
    if (this.current < this.slides.length - 1) {
      next_slide = this.slides[this.current + 1];
      if (next_slide.image.complete == null || next_slide.image.complete) {
        this.next();
      }
    } else { // we're at the last slide
      this.next();
    }
    
    this.play( );
  }


  this.valid_image = function() {
    // Returns 1 if a valid image has been set for the slideshow
  
    if (!this.image)
    {
      return false;
    }
    else {
      return true;
    }
  }

  this.getElementById = function(element_id) {
    // This method returns the element corresponding to the id

    if (document.getElementById) {
      return document.getElementById(element_id);
    }
    else if (document.all) {
      return document.all[element_id];
    }
    else if (document.layers) {
      return document.layers[element_id];
    } else {
      return undefined;
    }
  }
  

  this.set_image = function(imageobject) {

    if (!document.images)
      return;
    this.image = imageobject;
  }

  this.set_textarea = function(textareaobject) {

    this.textarea = textareaobject;
    this.display_text();
  }

  this.set_textid = function(textidstr) {

    this.textid = textidstr;
    this.display_text();
  }
}
/*------------------------------------------------------------------------------------------------------------------------------------------
END SLIDE SHOW
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START NAVIGATION
------------------------------------------------------------------------------------------------------------------------------------------*/

var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no
enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
this.positionshim() //call iframe shim function
}
},

positionshim:function(){ //display iframe shim function
if (this.enableiframeshim && typeof this.shimobject!="undefined"){
if (this.dropmenuobj.style.visibility=="visible"){
this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
this.shimobject.style.left=this.dropmenuobj.style.left
this.shimobject.style.top=this.dropmenuobj.style.top
}
this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
}
},

hideshim:function(){
if (this.enableiframeshim && typeof this.shimobject!="undefined")
this.shimobject.style.display='none'
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
if (window.createPopup && !window.XmlHttpRequest){ //if IE5.5 to IE6, create iframe for iframe shim technique
document.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
this.shimobject=document.getElementById("iframeshim") //reference iframe object
}
}

}
/*------------------------------------------------------------------------------------------------------------------------------------------
END NAVIGATION
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START JS.JS
------------------------------------------------------------------------------------------------------------------------------------------*/
	String.prototype.trim = function()    // trims white space off both ends of this string
	{
		return( (ar=/^\s*([\s\S]*\S+)\s*$/.exec(this)) ? ar[1] : "" ); 
	}
	
	function numeralsOnly(evt) {
	    evt = (evt) ? evt : event;
	    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode :
	        ((evt.which) ? evt.which : 0));
	    if((charCode == 8) || (charCode == 9) || (charCode == 46) ||  (charCode >=48 && charCode <=57))
	    {
	        return true;
	    }
	    return false;
	}
	
	function alpha_num(e)
	{
		var key;
		var keychar;
		
		if (window.event)
		   key = window.event.keyCode;
		else if (e)
		   key = e.which;
		else
		   return true;
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		
		if ((key==null) || (key==0) || (key==8) || 
		    (key==9) || (key==13) || (key==109) || (key==27) )
		   return true;
		
		else if ((("abcdefghijklmnopqrstuvwxyz0123456789_:./").indexOf(keychar) > -1))
		   return true;
		else
		   return false;
	}
	
	function showKeyCode(e)
	{
		alert("keyCode for the key pressed: " + e.keyCode + "\n");
	}
	
	function alpha(e)
	{
		var key;
		var keychar;
		
		if (window.event)
		   key = window.event.keyCode;
		else if (e)
		   key = e.which;
		else
		   return true;
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		
		if ((key==null) || (key==0) || (key==8) || 
		    (key==9) || (key==13) || (key==27) || (key==32) )
		   return true;
		
		else if ((("abcdefghijklmnopqrstuvwxyz").indexOf(keychar) > -1))
		   return true;
		else
		   return false;
	}	
	
	function isEMAIL(address) 
	{
		var str =address; // email string
	
	  	var reg2 = /^[\w-\.]+\@[\w\.-]+\.[a-z]{2,4}$/; // valid
		if (reg2.test(str))
	  	{
	 	 	return true;
	  	}
	  	else
	  	{
	  		return false;
	  	}
	  	
	}
	
	function confirm_pass(password1, password2, msg)
	{
	    if(password1.value != password2.value)
	    {
	       alert(msg);
	       return false;
	    }
	   return true;
	}
	
	function reload()
	{
		 iframe = document.getElementById('capo');
		 if (!iframe) return false;
	 	 iframe.src = iframe.src;
	}
	
	var http = createRequestObject();
	var div_id = 'result';
	
	function createRequestObject()
	{
		var pogi;
		var browser = navigator.appName;
		if(browser == "Microsoft Internet Explorer")
		{
			pogi = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			pogi = new XMLHttpRequest();
		}
		
		return pogi;
	}
	
	function sndReq(file, action)
	{
	    http.open('get', file + '?' + action);
		http.onreadystatechange = handleResponse;
		http.send(null);
	}
	
	function handleResponse()
	{
		if(http.readyState == 4)
		{
			var response = http.responseText;
			document.getElementById(div_id).innerHTML = response;
		}
	}
	
	function uf_check_username(param_id)
	{
		dfrm = document.forms.frm_register;
		div_id = param_id;
		
		if (dfrm.username.value.trim()!='')	
		{
			if(dfrm.username.value.length >= 3 && dfrm.username.value.length < 31)
			{
				document.getElementById(div_id).innerHTML = "Loading...<img src='images/loading.gif'>";
				sndReq('check_user.php','username='+dfrm.username.value.trim());	
			}
			else
			{
				alert('Please enter a username between 3 to 32 characters.');
				dfrm.username.focus();
			}
		}
		else
		{
			alert('Please enter a username.');
			dfrm.username.focus();
		}
	}
	
	function alpha_num(e)
	{
		var key;
		var keychar;
		
		if (window.event)
		   key = window.event.keyCode;
		else if (e)
		   key = e.which;
		else
		   return true;
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		
		if ((key==null) || (key==0) || (key==8) || 
		    (key==9) || (key==13) || (key==109) || (key==27) || (key==32) )
		   return true;
		
		else if ((("abcdefghijklmnopqrstuvwxyz0123456789_:./").indexOf(keychar) > -1))
		   return true;
		else
		   return false;
	}
	
	function alpha_num2(e)
	{
		var key;
		var keychar;
		
		if (window.event)
		   key = window.event.keyCode;
		else if (e)
		   key = e.which;
		else
		   return true;
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		
		if ((key==null) || (key==0) || (key==8) || 
			(key >=65 && key <=90) || (key >=48 && key <=57)  || 
		    (key==9) || (key==13) || (key==27) || (key==16) || (key >=97 && key <=122) )
		   return true;
		
		else if ((("_").indexOf(keychar) > -1))
		   return true;
		else
		   return false;
	}
	
	function showKeyCode(e)
	{
		alert("keyCode for the key pressed: " + e.keyCode + "\n");
	}
	
	function alpha(e)
	{
		var key;
		var keychar;
		
		if (window.event)
		   key = window.event.keyCode;
		else if (e)
		   key = e.which;
		else
		   return true;
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		
		// control keys
		if ((key==null) || (key==0) || (key==8) || 
		    (key==9) || (key==13) || (key==27) || (key==32) )
		   return true;
		
		else if ((("abcdefghijklmnopqrstuvwxyz").indexOf(keychar) > -1))
		   return true;
		else
		   return false;
	}	
	
	function check_values(dfrm)
	{
		if (dfrm.username.value.trim() !='')	
		{
			if(dfrm.username.value.length < 3 || dfrm.username.value.length > 32)
			{
				alert('Please enter a username with the range of 3 to 32 characters length.');
				dfrm.username.focus();	
				return false;
			}
		}
		else
		{
			alert('Please enter a username with the range of 3 to 32 characters length.');
			dfrm.username.focus();
			return false;
		}
		
		if (dfrm.password.value.trim() !='')
		{
			if(dfrm.password.value.length < 6 || dfrm.password.value.length > 32)
			{
				alert('Please enter a password with the range of 6 to 32 characters length.');
				dfrm.password.focus();	
				return false;
			}
		}
		else
		{
			alert('Please enter a password with the range of 6 to 32 characters length.');
			dfrm.password.focus();
			return false;
		}
		
		if (dfrm.repassword.value.trim() !='')
		{
			if(dfrm.repassword.value.length < 6 || dfrm.repassword.value.length > 32)
			{
				alert('Please re-type your password with the range of 6 to 32 characters length.');
				dfrm.repassword.focus();	
				return false;
			}
		}
		else
		{
			alert('Please re-type your password with the range of 6 to 32 characters length.');
			dfrm.repassword.focus();
			return false;
		}
		
		if(!confirm_pass(dfrm.password, dfrm.repassword, "Please ensure that both Passwords match."))
		{
			dfrm.repassword.focus();
			return false;
		}

		if(dfrm.email1.value.trim() != '')
		{
			if(!isEMAIL(dfrm.email1.value))
			{
				alert('Please enter a valid email address.');
				dfrm.email1.focus();
				return false;
			}	
		}
		else
		{
			alert('Please enter your email address.');
			dfrm.email1.focus();
			return false;
		}

		if(dfrm.country.value.trim() == '')
		{
			alert('Please select your country.');
			dfrm.country.focus();
			return false;
		}
		
		if(dfrm.country.value.trim() != '')
		{
			if(dfrm.country.value == "167")
			{
				if(dfrm.mob_prefix1.value.trim() == '')
				{
					alert('Please select your mobile prefix1.');
					dfrm.mob_prefix1.focus();
					return false;
				}
				
				if(dfrm.mob_no1.value.trim() == '')
				{
					alert('Please enter your mobile number1.');
					dfrm.mob_no1.focus();
					return false;
				}
				
				if(dfrm.mob_no1.value.length != 7)
				{
					alert('Please enter your mobile number1 with at least 7 numerals length.');
					dfrm.mob_no1.focus();
					return false;
				}
				/*
				if(dfrm.mob_prefix2.value.trim() != '' || dfrm.mob_no2.value.trim() != '')
				{
					if(dfrm.mob_prefix2.value.trim() == '')
					{
						alert('Please select your mobile prefix2.');
						dfrm.mob_prefix2.focus();
						return false;
					}
					if(dfrm.mob_no2.value.trim() == '')
					{
						alert('Please enter your mobile number2.');
						dfrm.mob_no2.focus();
						return false;
					}
					
					if(dfrm.mob_no2.value.length != 7)
					{
						alert('Please enter your mobile number2 with at least 7 numerals length.');
						dfrm.mob_no2.focus();
						return false;
					}
				}
				
				if(dfrm.mob_prefix3.value.trim() != '' || dfrm.mob_no3.value.trim() != '')
				{
					if(dfrm.mob_prefix3.value.trim() == '')
					{
						alert('Please select your mobile prefix3.');
						dfrm.mob_prefix3.focus();
						return false;
					}
					if(dfrm.mob_no3.value.trim() == '')
					{
						alert('Please enter your mobile number3.');
						dfrm.mob_no3.focus();
						return false;
					}
					
					if(dfrm.mob_no3.value.length != 7)
					{
						alert('Please enter your mobile number3 with at least 7 numerals length.');
						dfrm.mob_no3.focus();
						return false;
					}
				}
				*/
			}
		}

		if(dfrm.newsletter.value.trim() != '' && dfrm.html.value.trim() == '')
		{
			alert('Please choose the format of your newsletter.');
			dfrm.html.focus();
			return false;
		}
		
		if(dfrm.usercode.value.trim() == '')
		{
			alert('Please enter the code in the box.');
			dfrm.usercode.focus();
			return false;
		}
		else
		{
			if(dfrm.usercode.value.length != 5)
			{
				alert('Please enter the exact length of code in the box.');
				dfrm.usercode.focus();
				return false;
			}
		}
	}
	
	function change_country()
	{
		dfrm = document.forms.frm_register;
		if(dfrm.country.value == "167")
		{
			dfrm.mob_prefix1.style.display = '';
			document.getElementById('span_red').style.display = '';
			document.getElementById('mob_no1').setAttribute('maxlength', 7);
			dfrm.mob_no1.style.width = '146px';
		}
		else
		{
			dfrm.mob_prefix1.style.display = 'none';
			document.getElementById('span_red').style.display = 'none';
			document.getElementById('mob_no1').setAttribute('maxlength', 13);
			dfrm.mob_no1.style.width = '200px';
		}
		
	}
	
	function check_button()
	{
		dfrm = document.forms.frm_register;
		if(dfrm.checkbox.checked != true)
		{
			dfrm.bt_submit.disabled = true;
		}
		else
		{
			dfrm.bt_submit.disabled = false;
		}
	}
	var checkflag = "false";
	
	function check_all()
	{
		dfrm = document.forms.frm_register;
		var number = dfrm.num_rec.value;
		if (checkflag == "false") 
		{
			for (i = 0; i < number; i++) 
			{
				dfrm["interest" + i].checked = true;
			}
			checkflag = "true";
			return "Uncheck All"; 
		}
		else 
		{
			for (i = 0; i < number; i++) 
			{
				dfrm["interest" + i].checked = false;
			}
			checkflag = "false";
			return "Check All"; 
		}
	}
/*------------------------------------------------------------------------------------------------------------------------------------------
END JS.JS
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START STAR
------------------------------------------------------------------------------------------------------------------------------------------*/
var Stars = Class.create();
Stars.prototype = {
	_x: 0,
	_y: 0,
	initialize: function(options)
	{

		this._initialized = false;

		this.options = {
			bindField: null,			// Form Field to bind the value to
			maxRating: 5,				// Maximum rating, determines number of stars
			container: null,			// Container of stars
			imagePath: 'images/',		// Path to star images
			callback: null,				// Callback function, fires when the stars are clicked
			actionURL: null,			// URL to call when clicked. The rating will be appended to the end of the URL (eg: /rate.php?id=5&rating=)
			value: 0,					// Initial Value
			locked: false
		};
		Object.extend(this.options, options);
		this.locked = this.options.locked ? true : false;

		this._starSrc = {
			empty: this.options.imagePath + "star-empty.gif",
			full: this.options.imagePath + "star.gif",
			half: this.options.imagePath + "star-half.gif"
		};

		for(var x in this._starSrc)
		{
			var y = new Image();
			y.src = this._starSrc[x];
		}

		document.getElem

		this._setStarSrc = {
			empty: this.options.imagePath + "star-empty.gif",
			full: this.options.imagePath + "star.gif",
			half: this.options.imagePath + "star-half.gif"
		};

		for(var x in this._setStarSrc)
		{
			var y = new Image();
			y.src = this._setStarSrc[x];
		}

		this.value = -1;
		this.stars = [];
		this._clicked = false;


		if(this.options.container)
		{
			this._container = $(this.options.container);
			this.id = this._container.id;
		}
		else
		{
			this.id = 'starsContainer.' + Math.random(0, 100000);
			document.write('<span id="' + this.id + '"></span>');
			this._container = $(this.id);
		}
		this._display();
		this.setValue(this.options.value);
		this._initialized = true;
	},
	_display: function()
	{
		for(var i = 0; i < this.options.maxRating; i++)
		{
			var star = new Image();
			star.src = this.locked ? this._starSrc.empty : this._setStarSrc.empty;
			star.style.cursor = 'pointer';
			star.title = 'Rate as ' + (i + 1);
			!this.locked && Event.observe(star, 'mouseover', this._starHover.bind(this));
			!this.locked && Event.observe(star, 'click', this._starClick.bind(this));
			!this.locked && Event.observe(star, 'mouseout', this._starClear.bind(this));
			this.stars.push(star);
			this._container.appendChild(star);
		}
	},
	_starHover: function(e)
	{
		if(this.locked) return;
		if(!e) e = window.event;
		var star = Event.element(e);

		var greater = false;
		for(var i = 0; i < this.stars.length; i++)
		{
			this.stars[i].src = greater ? this._starSrc.empty : this._starSrc.full;
			if(this.stars[i] == star) greater = true;
		}
	},
	_starClick: function(e)
	{
		if(this.locked) return;
		if(!e) e = window.event;
		var star = Event.element(e);
		this._clicked = true;
		for(var i = 0; i < this.stars.length; i++)
		{
			if(this.stars[i] == star)
			{
				this.setValue(i+1);
				break;
			}
		}
	},
	_starClear: function(e)
	{
		if(this.locked && this._initialized) return;
		var greater = false;
		for(var i = 0; i < this.stars.length; i++)
		{
			if(i > this.value) greater = true;
			if((this._initialized && this._clicked) || this.value == -1)
				this.stars[i].src = greater ? (this.value + .5 == i) ? this._starSrc.half : this._starSrc.empty : this._starSrc.full;
			else
				this.stars[i].src = greater ? (this.value + .5 == i) ? this._setStarSrc.half : this._setStarSrc.empty : this._setStarSrc.full;
		}
	},
	setValue: function(val)
	{
		if(this.locked && this._initialized) return;
		this.value = val-1;
		if(this.options.bindField)
			$(this.options.bindField).value = val;
		if(this._initialized)
		{
			if(this.options.actionURL)
				new Ajax.Request(this.options.actionURL + val, {onComplete: this.options['callback'], method: 'get'});
			else
				if(this.options.callback)
					this.options['callback'](val);
		}
		this._starClear();
	}
};
/*------------------------------------------------------------------------------------------------------------------------------------------
END STAR
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START BOOKMARK
------------------------------------------------------------------------------------------------------------------------------------------*/
function bookmark() {

	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

		var url="http://www.pep.ph{/literal}{php} echo $uri = addslashes($_SERVER['REQUEST_URI']); {/php}{literal}";
		var title="PEP - {/literal}{$pageTitle}{literal}";
		window.external.AddFavorite(url,title);

	} else {

		var msg = "Bookmark Us by hitting Ctrl + D";
		alert(msg);

	}

}
/*------------------------------------------------------------------------------------------------------------------------------------------
END BOOKMARK
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START JS TREE
------------------------------------------------------------------------------------------------------------------------------------------*/
	var dhtmlgoodies_tree;
	var imageFolder = 'http://pep.ph/images/web/';	// Path to images
	var folderImage = 'folder-tree-static-images/dhtmlgoodies_folder.gif';
	var plusImage = 'folder-tree-static-images/dhtmlgoodies_plus.gif';
	var minusImage = 'folder-tree-static-images/dhtmlgoodies_minus.gif';
	var initExpandedNodes = '';	// Cookie - initially expanded nodes;
	var fileName = 'updateNode.php';	// External file called by AJAX	
	var timeoutEdit = 20;	// Lower value = shorter delay from mouse is pressed down to textbox appears.
	var displayNode = '';
	
	var ajax = new sack();
	
	function Get_Cookie(name) { 
	   var start = document.cookie.indexOf(name+"="); 
	   var len = start+name.length+1; 
	   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
	   if (start == -1) return null; 
	   var end = document.cookie.indexOf(";",len); 
	   if (end == -1) end = document.cookie.length; 
	   return unescape(document.cookie.substring(len,end)); 
	} 

	function Set_Cookie(name,value,expires,path,domain,secure) { 
		expires = expires * 60*60*24*1000;
		var today = new Date();
		var expires_date = new Date( today.getTime() + (expires) );
	    var cookieString = name + "=" +escape(value) + 
	       ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + 
	       ( (path) ? ";path=" + path : "") + 
	       ( (domain) ? ";domain=" + domain : "") + 
	       ( (secure) ? ";secure" : ""); 
	    document.cookie = cookieString; 
	} 
	
	function expandAll()
	{
		var menuItems = dhtmlgoodies_tree.getElementsByTagName('LI');
		for(var no=0;no<menuItems.length;no++){
			var subItems = menuItems[no].getElementsByTagName('UL');
			if(subItems.length>0 && subItems[0].style.display!='block'){
				showHideNode(false,menuItems[no].id.replace(/[^0-9]/g,''));
			}			
		}
	}
	
	function collapseAll()
	{
		var menuItems = dhtmlgoodies_tree.getElementsByTagName('LI');
		for(var no=0;no<menuItems.length;no++){
			var subItems = menuItems[no].getElementsByTagName('UL');
			if(subItems.length>0 && subItems[0].style.display=='block'){
				showHideNode(false,menuItems[no].id.replace(/[^0-9]/g,''));
			}			
		}		
	}
			
	function showHideNode(e,inputId)
	{
		if(inputId){
			if(!document.getElementById('dhtmlgoodies_treeNode'+inputId))return;
			thisNode = document.getElementById('dhtmlgoodies_treeNode'+inputId).getElementsByTagName('IMG')[0]; 
		}else {
			thisNode = this;
		}
		if(thisNode.style.visibility=='hidden')return;
		var parentNode = thisNode.parentNode;
		inputId = parentNode.id.replace(/[^0-9]/g,'');
		if(thisNode.src.indexOf('plus')>=0){
			thisNode.src = thisNode.src.replace('plus','minus');
			parentNode.getElementsByTagName('UL')[0].style.display='block';
			if(!initExpandedNodes)initExpandedNodes = ',';
			if(initExpandedNodes.indexOf(',' + inputId + ',')<0) initExpandedNodes = initExpandedNodes + inputId + ',';
			
		}else{
			thisNode.src = thisNode.src.replace('minus','plus');
			parentNode.getElementsByTagName('UL')[0].style.display='none';
			initExpandedNodes = initExpandedNodes.replace(',' + inputId,'');
		}	
		Set_Cookie('dhtmlgoodies_expandedNodes',initExpandedNodes,500);
	}

	function okToNavigate()
	{
		if(editCounter<10)return true;
		return false;		
	}
	
	var editCounter = -1;
	var editEl = false;
	
	function initEditLabel()
	{	
		if(editEl)hideEdit();
		editCounter = 0;
		editEl = this;	// Referenc to a Tag
		startEditLabel();
	}
	
	function startEditLabel()
	{
		if(editCounter>=0 && editCounter<10){
			editCounter = editCounter + 1;
			setTimeout('startEditLabel()',timeoutEdit);
			return;
		}
		if(editCounter==10){
			var el = editEl.previousSibling;
			el.value = editEl.innerHTML;
			editEl.style.display='none';
			el.style.display='inline';	
			el.select();
			return;
		}		
	}
	
	function showUpdate()
	{
		document.getElementById('ajaxMessage').innerHTML = ajax.response;
	}
	
	function hideEdit()
	{				
		var editObj = editEl.previousSibling;	
		if(editObj.value.length>0){
			editEl.innerHTML = editObj.value;	
			ajax.requestFile = fileName + '?updateNode='+editObj.id.replace(/[^0-9]/g,'') + '&newValue='+editObj.value;	// Specifying which file to get
			ajax.onCompletion = showUpdate;	// Specify function that will be executed after file has been found
			ajax.runAJAX();		// Execute AJAX function
						
		}
		editEl.style.display='inline';
		editObj.style.display='none';
		editEl = false;			
		editCounter=-1;
	}
	
	function mouseUpEvent()
	{
		editCounter=-1;		
	}
	
	function initTree()
	{
		dhtmlgoodies_tree = document.getElementById('dhtmlgoodies_tree');
		var menuItems = dhtmlgoodies_tree.getElementsByTagName('LI');	// Get an array of all menu items
		for(var no=0;no<menuItems.length;no++){
			var subItems = menuItems[no].getElementsByTagName('UL');
			var img = document.createElement('IMG');
			
			img.src = imageFolder + plusImage;
			img.onclick = showHideNode;
			if(subItems.length==0)img.style.visibility='hidden';
			var aTag = menuItems[no].getElementsByTagName('A')[0];
			
			if(aTag.id)numericId = aTag.id.replace(/[^0-9]/g,'');else numericId = (no+1);
			if(displayNode == aTag.id) { 
				img.src = imageFolder + minusImage;
				menuItems[no].getElementsByTagName('UL')[0].style.display='block';
			}
			else img.src = imageFolder + plusImage;	
			
			aTag.id = 'dhtmlgoodies_treeNodeLink' + numericId;
			
			var input = document.createElement('INPUT');
			input.style.width = '200px';
			input.style.display='none';
			menuItems[no].insertBefore(input,aTag);
			input.id = 'dhtmlgoodies_treeNodeInput' + numericId;
			input.onblur = hideEdit;
						
			menuItems[no].insertBefore(img,input);
			menuItems[no].id = 'dhtmlgoodies_treeNode' + numericId;
			aTag.onclick = okToNavigate;
			aTag.onmousedown = initEditLabel;
			var folderImg = document.createElement('IMG');
			if(menuItems[no].className){
				folderImg.src = imageFolder + menuItems[no].className;
			}else{
				folderImg.src = imageFolder + folderImage;
			}
		}	
		
		
		
		document.documentElement.onmouseup = mouseUpEvent;
	}
	
	function getView(view)
	{
		if(view == 'category') 
		{
			displayNode = 'node21';
		}
		else if(view == 'pick')
		{
			displayNode = 'node20';
		}
		else if(view == 'popular')
		{
			displayNode = 'node19';
		}
		else
		{
			displayNode = 'node1';
		}
	}
	
	window.onload = initTree;	
/*------------------------------------------------------------------------------------------------------------------------------------------
END SWF OBJECT JS
------------------------------------------------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------------------------------------------------
START STORY TRACKER
------------------------------------------------------------------------------------------------------------------------------------------*/
function show_track(tracker_frame) {
    if (curr_tracker_frame != tracker_frame) {
        if (curr_tracker_frame != 0) {
            Effect.SlideUp('tracker_details' + curr_tracker_frame);
            ttarget = document.getElementById("tracker_a" + curr_tracker_frame);
            ttarget.style.display = "";
            ttarget = document.getElementById("tracker_b" + curr_tracker_frame);
            ttarget.style.display = "none";
            setTimeout("Effect.SlideDown('tracker_details" + tracker_frame + "');", 650);
        } else {
            Effect.SlideDown('tracker_details' + tracker_frame);
        }                        
        ttarget = document.getElementById("tracker_a" + tracker_frame);
        ttarget.style.display = "none";
        ttarget = document.getElementById("tracker_b" + tracker_frame);
        ttarget.style.display = "";
        curr_tracker_frame = tracker_frame;
    } else {
        Effect.SlideUp('tracker_details' + curr_tracker_frame);
        ttarget = document.getElementById("tracker_a" + curr_tracker_frame);
        ttarget.style.display = "";
        ttarget = document.getElementById("tracker_b" + curr_tracker_frame);
        ttarget.style.display = "none";
        curr_tracker_frame = 0;
    }
}

function close_track(tracker_frame) {
        Effect.SlideUp('tracker_details' + tracker_frame);
        ttarget = document.getElementById("tracker_a" + tracker_frame);
        ttarget.style.display = "";
        ttarget = document.getElementById("tracker_b" + tracker_frame);
        ttarget.style.display = "none";
}

function open_track(tracker_frame) {
        Effect.SlideDown('tracker_details' + tracker_frame);
        ttarget = document.getElementById("tracker_a" + tracker_frame);
        ttarget.style.display = "none";
        ttarget = document.getElementById("tracker_b" + tracker_frame);
        ttarget.style.display = "";
}
/*------------------------------------------------------------------------------------------------------------------------------------------
END STORY TRACKER
------------------------------------------------------------------------------------------------------------------------------------------*/

