function saveform(formname, validateid, color1, color2, querystring) {
    if (validateform(formname, color1, color2)) {
        document.getElementById(validateid).style.display = "block";
        document.getElementById(validateid).innerHTML = "saving...";
        new Ajax.Request('/ajax/saveform.aspx?' + querystring, {
            method: "post",
            parameters: Form.serialize(document.forms[formname]),
            onComplete: function(transport) {
                var r = transport.responseText;
                document.getElementById(validateid).innerHTML = "SAVED";
                fadeout(validateid);
                if (window.opener) {
                    //POP UP
                    window.opener.loadit();
                    window.close();
                } else {
                    //NEW
                    if (qs(querystring, 'mode') == 'new') {
                        var redirecturl = '';
                        if (qs(querystring, 'phid') == '0') {
                            redirecturl = 'tid=' + qs(querystring, 'tid') + '&hid=' + parseInt(r);
                        } else {
                            redirecturl = 'tid=' + qs(querystring, 'tid') + '&phid=' + qs(querystring, 'phid') + '&hid=' + parseInt(r);
                        }
                        document.location.href = '?' + redirecturl;
                    }
                }
            }
        }
	    );
    } else {
            document.getElementById(validateid).innerHTML = "Please fill in required fields.";
            fadeout(validateid);
    }
}

function sendfeedbackform(formname, validateid, color1, color2) {
    if (validateform(formname, color1, color2)) {
        var email = document.getElementById("feedbackemail").value;
        if (validEmail(email)) {
            document.getElementById('feedbacksendbutton').src = '/images/indicator.gif';
            new Ajax.Request('/sc_sendfeedback.ashx', {
                method: "post",
                parameters: Form.serialize(document.forms[formname]),
                onComplete: function(transport) {
                    document.getElementById('sendfeedbackwrapper').innerHTML = 'SENT, THANK YOU!';
                    var r = transport.responseText;
                }
            }
	        );
        } else {
            document.getElementById("feedbackemail").style.background = color1; 
        }
    }
}

function undock(code) {
    var message = 'Are you sure you want to undock this organization?';
    if (confirm(message)) { 
            new Ajax.Request('/sc_undock.ashx?id=' + code, {
            method: "get",
            onSuccess: function(transport, formname) {
            document.location.reload();
            }
        }
	);	 
    }
}

function adddockingcode(formname, color1, color2) {
    var validateid = 'validatemessage';
    $(validateid).innerHTML = '';
    if (validateform(formname, color1, color2)) {
        new Ajax.Request('/sc_adddockingcode.ashx', {
            method: "post",
            parameters: Form.serialize(document.forms[formname]),
            onComplete: function(transport) {
                var t = transport.responseText;
                if (t == 'true') {
                    document.getElementById(validateid).innerHTML = "SAVED";
                    fadeout(validateid);
                    window.opener.location.replace(window.opener.location);
                    window.close();
                } else {
                    $(validateid).innerHTML = transport.responseText;
                }
            }
        }//-request arguments
	    );     // new ajax request
    } else {
        $(validateid).innerHTML = 'Please fill in a docking code.';
    }
}

function open_popup(page) {
    top.window_handle = open(page, 'open_popup', 'scrollbars=yes,resizable=yes,width=520,height=550');
    top.window_handle.focus();
    if (!top.window_handle.opener) top.window_handle.opener = self;
}

function validatethisrecord(formname, color1, color2) {
    if (validateform(formname, color1, color2)) {
        window.close();
    }
}

function plustoggle(){
    var x=document.getElementsByTagName("img");
    for (var i=0;i<x.length;i++){
		if (x[i].className.indexOf('toggle')>-1) {
		 	x[i].onclick = function(){
		 	    if(this.src.indexOf('plus')>-1){
		 	        this.src = this.src.replace('plus','minus');
		 	    } else {
		 	        this.src = this.src.replace('minus','plus');
		 	    }
		 	}	
		}
	}
}

function togglediv(theid){
    Effect.toggle($(theid),'blind');
    //var o = $('a-' + theid).firstChild;
    //    var o = $('a-' + theid).childNodes[0];
    //    if (o.src.indexOf('/images/plus.gif') > -1 ){
    //        o.src = '/images/minus.gif';
    //        } else {
    //        o.src = '/images/plus.gif';
    //    }
}

function changetext(theid,text){
    $(theid).value = $(theid).value.replace(/>([^><]*)</gi,'>' + text.replace('<','').replace('>','') + '<');;
}

function changexml(theid){
    hiddenid = theid.replace('checkbox','hidden');
    if($(hiddenid).value.indexOf('selected="yes">')>-1){
          $(hiddenid).value = $(hiddenid).value.replace(/\"([^\"]*)\"/i,'\"\"');
    } else {
        $(hiddenid).value = $(hiddenid).value.replace(/\"([^\"]*)\"/i,'\"yes\"');
    }
}


function buildreflist(url){
	//AJAX POST
	new Ajax.Request('/sc_reflist.ashx', {
	method: "post",
	parameters: Form.serialize(document.forms.formdata),
	onComplete: function(transport) {
	          
	            if (url.indexOf('mode=1')>-1){
	                document.location.href = url;	
        	    	
	            } else {
	                new Ajax.Request(url, {
		            method: "get",
		            onSuccess: function(transport,formname) { 	
		                        if (transport.responseText != ''){
		                            document.location.href = transport.responseText;
		                        }
				             
			                }
			            }
			        );
        			
	            }	
            
			}
		}
	);	
}

function printpage(framename) {
	parent[framename].focus();
	parent[framename].print();
}

function uploadscreen(page) {
    top.window_handle = open(page,'uploadscreen','scrollbars=no,resizable=yes,width=270,height=220');
    top.window_handle.focus();
    if (!top.window_handle.opener) top.window_handle.opener = self;
}

function edit_popup(page) {
    top.window_handle = open(page,'edit_popup','scrollbars=yes,resizable=yes,width=470,height=580');
    top.window_handle.focus();
    if (!top.window_handle.opener) top.window_handle.opener = self;
}

function open_popup2(page,name,properties) {
    top.window_handle = open(page,name,properties);
    top.window_handle.focus();
    if (!top.window_handle.opener) top.window_handle.opener = self;
}

function initpopcalendar(formname,fieldname,fieldvalue){
    if (document.forms[formname]){
        var x = document.forms[formname][fieldname];
        x.onfocus = function() {
            popCalendar.show(this,x,'mm/dd/yyyy','en',1,null,null,0)
        }
    }
}

function confirm_HUH(formname,color1,color2) {
    if(validateform(formname,color1,color2)){
       	document[formname].submit();
    }
}

function qs(querystring, variable) {
    var vars = querystring.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
            return pair[1];
        }
    }
}

function fadeout(daid){
	var t = setTimeout("Effect.Fade('" + daid + "')",2000);
}

//LOG IN
function logina(formname, validateid, color1, color2) {
	//VALIDATE REQUIRED
	if(validateform(formname,color1,color2)){
		//AJAX POST
		new Ajax.Request('sc_login.ashx', {
		method: "post",
		parameters: Form.serialize(document.forms[formname]),
		onSuccess: function(transport,formname) { 	
			//LOG IN EXISTS?
			if (transport.responseText=='true'){
				//document.forms.formname.submit();
			    document.getElementById(validateid).innerHTML = 'Loading...';
			    document.location.href = homepage;
				//document.location.href='https://secure.everfile.com/mainconsole.aspx';
			} else {
				document.getElementById(validateid).innerHTML = 'Invalid Log In';
				if (document.getElementById(validateid).style.display == "none"){
					Effect.Appear(validateid,'blind');
				} else {
					Effect.Shake(validateid);
					}
				}
			}//-onSuccess
			}//-request arguments
			);// new ajax request		
	} else {
			//FILL IN THE REQUIRED FIELDS
			if (document.getElementById(validateid).style.display == "none"){
				document.getElementById(validateid).innerHTML = 'Please fill in required fields';
					Effect.Appear(validateid,'blind');
					} else {
					Effect.Shake(validateid);
					}
	}
}

//LOG OFF
function logoff(){
    new Ajax.Request('sc_logout.ashx', {
        method: "get",
        onSuccess: function(transport, formname) {
            document.location.href = '/';
            }
        }
	);		
}

//RECYCLE
function recycle(hid){
	Lightbox.showBoxByID('hiddenDiv1', 248, 130);
	var ryes = document.getElementById('recycle_yes');
    var rno = document.getElementById('recycle_no');
    ryes.onclick = function() {

        new Ajax.Request('sc_recycle.ashx?hid=' + hid, {
            method: "get",
            onSuccess: function(transport) {
                loadit();
                Lightbox.hideBox();
            }
        }
        );
    }
    rno.onclick = function() {
       Lightbox.hideBox();
    } 
}

//RECYCLE
function recycleresume(rid) {
    Lightbox.showBoxByID('hiddenDiv1', 350, 100);
    var ryes = document.getElementById('recycle_yes');
    var rno = document.getElementById('recycle_no');
    ryes.onclick = function() {
    document.location.reload();
        new Ajax.Request('/sc_recycleresume.ashx?rid=' + rid, {
            method: "get",
            onSuccess: function(transport) {
                document.location.reload();
            }
        }
	        );
    }
    rno.onclick = function() {
        Lightbox.hideBox();
    }
}

//VALIDATION
function createaccount(formname,validateid,indicatorid,color1,color2) {
	//VALIDATE REQUIRED
	if(validateform(formname,color1,color2)){	 
        document.getElementById(indicatorid).style.display = "block";
	    //document.forms[formname].__VIEWSTATE.name = 'NOVIEWSTATE';
	    //document.forms[formname].__VIEWSTATE.id= 'NOVIEWSTATE';

		new Ajax.Request('sc_createnewaccount.ashx', {
		method: "post",
		parameters: Form.serialize(document.forms[formname]),
		onComplete: function(transport) {
		        var r = transport.responseText; 
		        if (!r.indexOf("KeepGoing")){
		            //document.forms[formname].NOVIEWSTATE.name = '__VIEWSTATE';
		            //document.forms[formname].NOVIEWSTATE.id = '__VIEWSTATE';
		            document.forms[formname].submit();
		        } else {
		            document.getElementById(indicatorid).style.display = "none";
		            document.getElementById(validateid).innerHTML = r;
                    formfieldbg(r,"Zip","zip",color1,color2);
                    formfieldbg(r,"Email","email",color1,color2);
                    formfieldbg(r,"Email","confirmemail",color1,color2);
                    formfieldbg(r,"Passwords","password",color1,color2);
                    formfieldbg(r,"Passwords","password2",color1,color2);	           
		            if (document.getElementById(validateid).style.display == "none"){
		                document.getElementById(validateid).style.display = "block";
		            } else {
		                Effect.Shake(validateid);
		            }
		        }
			}
		}
		);
	} else {
	    document.getElementById(validateid).innerHTML = 'Please fill in Required Fields.';
	    if (document.getElementById(validateid).style.display == "none"){
			Effect.Appear(validateid,'blind');
		} else {
			Effect.Shake(validateid);
		}
	}
}

function validate_privacyterms(formname,validateid,indicatorid,color1,color2) {
	//VALIDATE REQUIRED
	if(validateform(formname,color1,color2)){	 
        document.getElementById(indicatorid).style.display = "block";
        new Ajax.Request('sc_registerstep2.ashx', {
		method: "post",
		parameters: Form.serialize(document.forms[formname]),
		onComplete: function(transport) {
		        var r = transport.responseText; 
		        if (!r.indexOf("KeepGoing")){
		            document.forms[formname].submit();
		        } else {
		            document.getElementById(indicatorid).style.display = "none";
		            document.getElementById(validateid).innerHTML = r;       
		            if (document.getElementById(validateid).style.display == "none"){
		                document.getElementById(validateid).style.display = "block";
		            } else {
		                Effect.Shake(validateid);
		            }
		        }
			}
		}
		);
	} else {
	    //document.getElementById(validateid).innerHTML = 'You must agree to terms of use in order to proceed with registration.';
	    if (document.getElementById(validateid).style.display == "none"){
			Effect.Appear(validateid,'blind');
		} else {
			Effect.Shake(validateid);
		}
	}
}

//EMAIL PASSWORD
function emailpassworda(formname,validateid,color1,color2) {
	//VALIDATE REQUIRED
	if(validateform(formname,color1,color2)){
		//EMAIL IS VALID?
		var email = document.getElementById("passwordemail").value;
		var theid = validateid;

		if(validEmail(email)){
			//AJAX POST
			new Ajax.Request('sc_emailpassword.ashx', {
			method: "post",
			parameters: Form.serialize(document.forms[formname]),
			onSuccess: function(transport,formname) { 
				var validatemessage
				var theid = validateid;
				//USER IS AVAILABLE?
				if (transport.responseText=='true'){	
					document.getElementById(theid).innerHTML = 'Your password has been emailed.';
					Effect.Appear(theid,'blind');
					var t = setTimeout("Effect.toggle('emailme');",2500);
				} else {
					document.getElementById(theid).innerHTML = transport.responseText;
					if (document.getElementById(theid).style.display == "none"){
					Effect.Appear(theid,'blind');
					} else {
					Effect.Shake(theid);
					}
				}
				}
				}
				);// new ajax request
			} else {
				document.getElementById(theid).innerHTML = 'Invalid Email';
				document.getElementById("passwordemail").style.background = color1; 
				if (document.getElementById(theid).style.display == "none"){
					Effect.Appear(theid,'blind');
					} else {
					Effect.Shake(theid);
			}
		}
	}
}

function changepassword(formname,validateid,indicatorid,color1,color2) {
	//VALIDATE REQUIRED
	if(validateform(formname,color1,color2)){	 
        document.getElementById(indicatorid).style.display = "block";
        new Ajax.Request('sc_changepassword.ashx', {
		method: "post",
		parameters: Form.serialize(document.forms[formname]),
		onComplete: function(transport) {
		        var r = transport.responseText; 
		        if (!r.indexOf("KeepGoing")){
		            document.forms[formname].submit();
		        } else {
		            document.getElementById(indicatorid).style.display = "none";
		            document.getElementById(validateid).innerHTML = r;       
		            if (document.getElementById(validateid).style.display == "none"){
		                document.getElementById(validateid).style.display = "block";
		            } else {
		                Effect.Shake(validateid);
		            }
		        }
			}
		}
		);
	} else {
	    if (document.getElementById(validateid).style.display == "none"){
			Effect.Appear(validateid,'blind');
		} else {
			Effect.Shake(validateid);
		}
	}
}

function changeinfo(formname,validateid,indicatorid,color1,color2) {
	//VALIDATE REQUIRED
	if(validateform(formname,color1,color2)){	 
        document.getElementById(indicatorid).style.display = "block";
        new Ajax.Request('sc_changeinfo.ashx', {
		method: "post",
		parameters: Form.serialize(document.forms[formname]),
		onComplete: function(transport) {
		        var r = transport.responseText; 
		        if (!r.indexOf("KeepGoing")){
		            document.forms[formname].submit();
		        } else {
		            document.getElementById(indicatorid).style.display = "none";
		            document.getElementById(validateid).innerHTML = r;       
		            if (document.getElementById(validateid).style.display == "none"){
		                document.getElementById(validateid).style.display = "block";
		            } else {
		                Effect.Shake(validateid);
		            }
		        }
			}
		}
		);
	} else {
	    if (document.getElementById(validateid).style.display == "none"){
			Effect.Appear(validateid,'blind');
		} else {
			Effect.Shake(validateid);
		}
	}
}


function cancelaccount(formname,validateid) {
	var msg = "Cancel Your Account?"
	if (confirm(msg)){	 
        new Ajax.Request('sc_cancelaccount.ashx', {
		method: "post",
		parameters: Form.serialize(document.forms[formname]),
		onComplete: function(transport) {
		        var r = transport.responseText; 
		        document.getElementById(validateid).innerHTML = r;  
		        document.getElementById(validateid).style.display = "block";  
			}
		}
		);
	
	}
}

function formfieldbg(search1,search2,elementid,color1,color2){
     if (search1.indexOf(search2)>-1){
        document.getElementById(elementid).style.background = color1;
     } else {
        document.getElementById(elementid).style.background = color2;
     }        
}

function ShowSwap(_image,_div){
    var x = document.getElementById(_div);
    x.src = _image
}

function showmenu(themenu){
	if (document.getElementById(themenu).style.display == "none"){
		document.getElementById(themenu).style.display = "block"
	} else {
		document.getElementById(themenu).style.display = "none"
	}
}

function ajaxfill(divid, url) {
    new Ajax.Request(url, {
        method: "get",
        onComplete: function(transport) {
            document.getElementById(divid).innerHTML = transport.responseText;
        } //-onSuccess
        }//-request arguments
	); // new ajax request	
}

function loaddiv(divid,ajaxpage,tab,handle){
	//TABS
	var x=document.getElementsByTagName("img");
	for (var i=0;i<x.length;i++){
		if (x[i].id.indexOf(handle)>-1){
			var element = document.getElementById(x[i].id);
			if (element.id == tab){
				element.src = element.src.replace('/off/','/on/')
			} else {
				element.onmouseover = tabover;
				element.onclick = tabclick; 
				element.onmouseout = tabout; 
				element.src = element.src.replace('/on/','/off/')
			}
		}
	}
	
	//AJAX REQUEST
	new Ajax.Request(ajaxpage, {
	method: "get",
	onComplete: function(transport) { 
		document.getElementById(divid).innerHTML = transport.responseText;
		}//-onSuccess
		}//-request arguments
		);// new ajax request	
}

function nav(id) {
    var x=document.getElementsByTagName("div");
    for (var i=0;i<x.length;i++){
		if (x[i].id.indexOf(id)>-1){
		    var element = document.getElementById(x[i].id);
		    var theid = element.id.replace(id,'');
		    //var theid = element.id.replace('_drop','');
		    //var theid = theid + "_drop";
		    //alert(theid);
            var dropdiv = document.getElementById(id + theid);
            dropdiv.onmouseover = function() {
                var navtoswitch = this.id;
                document.getElementById(navtoswitch).style.backgroundColor = "#c7e09f";
            }
            dropdiv.onmouseout = function() {
                //alert('hi1');
                var navtoswitch = this.id;
                document.getElementById(navtoswitch).style.backgroundColor = "#e2e1e1";
            }
        }
    }
    
}

function spidermenus(triggerhandle,menuhandle){
	var x=document.getElementsByTagName("div");
	for (var i=0;i<x.length;i++){
		if (x[i].id.indexOf(triggerhandle)>-1){
			//VARIABLES
			var element = document.getElementById(x[i].id);
			var theid = element.id.replace(triggerhandle,'');
            
			//TRIGGERS
			var thetrigger = document.getElementById(triggerhandle + theid);
			thetrigger.onmouseover = function() {      
				var menutoswitch;
				menutoswitch = this.id.replace('trigger','');
				
				document.getElementById(menutoswitch).style.display = "block";
				var navimg = this.id.replace('menutrigger','');
				document.getElementById('nav' + navimg).src = document.getElementById('nav' + navimg).src.replace('/off/','/roll/');
			    };
			thetrigger.onmouseout = function() {
				var menutoswitch;
				menutoswitch = this.id.replace('trigger','');
				document.getElementById(menutoswitch).style.display = "none";
                var navimg = this.id.replace('menutrigger','');
                
				document.getElementById('nav' + navimg).src = document.getElementById('nav' + navimg).src.replace('/roll/','/off/');
			};
			
			//MENUS
			var themenu = document.getElementById(menuhandle + theid);
			themenu.onmouseover = function() {
				var menutoswitch;
				menutoswitch = this.id;
				document.getElementById(menutoswitch).style.display = "block";
				
			};
			themenu.onmouseout = function() {
				var menutoswitch;
				menutoswitch = this.id;
				document.getElementById(menutoswitch).style.display = "none";
			};
		} 
	}
}

//VALIDATION
function validEmail(email) {
			var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
			return re.test(email); 
		}
		
//VALIDATION
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
		
//VALIDATION
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
		
//VALIDATION
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}
		
//VALIDATION
function isFilled(elm) {
	//alert(elm.type);
	//Last Updated by Sol - 6/14/07
	switch(elm.type){
	case "text":
		if (trim(elm.value) == "" || elm.value == null){
		return false;}
		else {return true;}
		break;
	case "password":
		if (trim(elm.value) == "" || elm.value == null){
		return false;}
		else {return true;}
		break;
	case "textarea":
		if (trim(elm.value) == "" || elm.value == null){
		return false;}
		else {return true;}
		break;
	case "select-one":
		var myindex=elm.selectedIndex;
		if (myindex==0){
		return false;}
		else {return true;}
		break;
	}
}

//VALIDATION
function validateform(formname,color1,color2){
	//last updated on 9/27/07
	//index of is mo betta
	var x = document.forms[formname];
	var allgood = true;
	for (var i=0;i<x.length;i++){
		if (x.elements[i].className.indexOf('required')>-1) {
		 	var thisformname = x.elements[i].name;
			var thisformid = x.elements[i].id;
			if (!isFilled(x.elements[i])) {
				document.getElementById(thisformid).style.background = color1;
				allgood = false;
				} else {
				  document.getElementById(thisformid).style.background = color2; 
				}
			}
		}
		if (allgood) {
			return true;
			} else {
			return false;
			}
	}
	
function spiderform(formname,validateid,successid,indicatorid,ajaxpage) {
	//VALIDATE REQUIRED
	if(validateform(formname,'#ffff00','#ffff00')){	
	
		//EMAIL IS VALID?
		var email = document.getElementById("email").value;
		if(!validEmail(email)){
			document.getElementById("email").style.background = "white"; 
			document.getElementById(validateid).innerHTML = 'Invalid Email';
			if (document.getElementById(validateid).style.display == "none"){
					Effect.Appear(validateid,'blind');
					} else {
					Effect.Shake(validateid);
					}
			} else {
			document.getElementById(validateid).style.display = "none";
			document.getElementById(indicatorid).style.display = "block";
			//alert('got here')
			//AJAX POST
			new Ajax.Request(ajaxpage, {
			method: "post",
			parameters: Form.serialize(document.forms[formname]),
			onComplete: function(transport) {		
			document.getElementById(successid).innerHTML = transport.responseText;
			document.getElementById(indicatorid).style.display = "none";
				//alert(transport.responseText);			
				
				}//-onSuccess
			}//-request arguments
			);// new ajax request	
			
			//document.form.formname.submit();	
			}
	}
}

//IMAGE ROLLOVER
function rolloverInit() {
    var x = document.getElementsByTagName("img");
    for (var i = 0; i < x.length; i++) {
        if (x[i].className.indexOf('rollover') > -1) {
            x[i].onmouseover = function() {
                this.src = this.src.replace('/off/', '/roll/')
            }
            x[i].onmouseout = function() {
                this.src = this.src.replace('/roll/', '/off/')
            }
        }
    }
}

//SLIDE

function SlidesShow(){
    //PROPERTIES
    this.slideTotal = 0;
    this.slideContainer = ''; //ID NAME
    this.slideWrapper = '';//ID NAME
    this.nextButton = ''; //ID OF HREF(SO THAT ELEMENT CAN BE TEXT OR IMAGE)
    this.prevButton = '';
    this.slideIncrement = 5; //SLIDE INCREMENTS
    this.slideWidth = 350; // WIDTH OF EACH DIV OR IMAGE
    this.next = nextSlide;
    this.previous = prevSlide;
    this.nextUrl = '';
    this.prevUrl = '';
  
    //VARIABLES
    var loopI = 0; //KEEPS TRACK OF EACH slideIncrement FROM 0 TO slideWidth, 50, 100, 150, 200
    var goNext = null;
    var goBack = null;
    var me = this;
    
    function setProperties(){
          me.prevUrl = document.getElementById(me.prevButton).style.href;
          me.nextUrl = document.getElementById(me.nextButton).style.href;
    }
    
    //METHODS
    function nextSlide(){  
	    document.getElementById(me.prevButton).style.display = "block";
	    goNext = setInterval(nextSlideDetail,1);
    }
    
    function prevSlide(){
	    goBack = setInterval(prevSlideDetail,1);
    }
    
    function nextSlideDetail(slideEnd,nextUrl){
        document.getElementById(me.nextButton).removeAttribute("href");  
	    var slideStart = parseFloat(document.getElementById(me.slideContainer).style.left);
	    slideEnd = slideStart - me.slideWidth;
	    var endFrame = 0 - ((me.slideTotal-1) * me.slideWidth);
	     
	    var addIncrement;
	    if ((loopI + me.slideIncrement) > me.slideWidth){

	         addIncrement = me.slideWidth -loopI;
	    } else {
	        addIncrement = me.slideIncrement;
	    }

	    loopI += me.slideIncrement;
	    if(slideEnd <= endFrame){
		     document.getElementById(me.nextButton).style.display = "none";
	    }
	    
	    document.getElementById(me.slideContainer).style.left = slideStart - addIncrement + 'px';
	    if(loopI>=me.slideWidth){
	        document.getElementById(me.nextButton).setAttribute('href',me.nextUrl);
		    clearInterval(goNext);
		    loopI = 0;
	    }
    }
    
    function prevSlideDetail(){
        document.getElementById(me.prevButton).removeAttribute("href");
	    var slideStart = parseFloat(document.getElementById(me.slideContainer).style.left);
	    slideEnd = slideStart + me.slideWidth;    
	        
	    var addIncrement;
	    if ((loopI + me.slideIncrement) > me.slideWidth){
	         addIncrement = me.slideWidth -loopI;
	    } else {
	        addIncrement = me.slideIncrement;
	    }
	    loopI += me.slideIncrement;
 
	    document.getElementById(me.slideContainer).style.left = slideStart + addIncrement + 'px';
	    if(loopI>=me.slideWidth){
	        document.getElementById(me.prevButton).setAttribute('href', me.prevUrl);
		    clearInterval(goBack);
		    loopI = 0;
		    if(slideStart == -addIncrement){
		       document.getElementById(me.prevButton).style.display = "none";
		        document.getElementById(me.nextButton).style.display = "block";
		    } else {
                document.getElementById(me.nextButton).style.display = "block";
		    }
	    }
    }
}

//IMAGE ROLLOVER
//Last Update August 1, 2008
function setupRollover(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	//alert(thisImage.id);
	thisImage.outImage.id = thisImage.id;
	thisImage.onmouseout = rollOut;
	thisImage.overImage = new Image();
	thisImage.overImage.id = thisImage.id
	thisImage.overImage.src = thisImage.src.replace('/off/','/roll/')
	thisImage.onmouseover = rollOver;
}

//IMAGE ROLLOVER
function rollOver() {
	this.src = this.overImage.src;
}

//IMAGE ROLLOVER
function rollOut() {
	this.src = this.outImage.src;
}

//TOOLTIP
function showworld(id,info){
    $(id).style.display = 'block';
    $(info).style.position = 'relative';
    $(id).onmouseout = function(){
        $(id).style.display = 'none'; 
        $(info).style.position = 'static';   
    }
    $(id).onmouseover = function(){
        this.style.display = 'block';
        $(info).style.position = 'relative';
    }
}

function showworld1(id,info){
    $(id).style.display = 'none';
    $(info).style.position = 'static';  
}

window.onload = masterloader;

function masterloader(){
	rolloverInit();
	spidermenus('menutrigger','menu');
	nav('sc_header_');
	//nav('drop');
	plustoggle();
	
}
