
function pagePreventing(iIndex) {
		if (iIndex == 0) site = "";
		else if (iIndex == 1) site = "../main.php?t=article&p=2361";
		else if (iIndex == 2) site = "../main.php?t=article&p=3087";
		else if (iIndex == 3) site = "../main.php?t=article&p=3089";
		else if (iIndex == 4) site = "../main.php?t=article&p=2346";
		else if (iIndex == 5) site = "../main.php?t=article&p=1946";
		else if (iIndex == 6) site = "../main.php?t=article&p=3095";
		else if (iIndex == 7) site = "../main.php?t=article&p=2325";		
		else if (iIndex == 8) site = "../main.php?t=article&p=2325";
		else if (iIndex == 9) site = "../main.php?t=article&p=2313";
		else if (iIndex == 10) site = "../main.php?t=article&p=2808";
		else if (iIndex == 11) site = "../main.php?t=article&p=2347";
		else if (iIndex == 12) site = "../main.php?t=article&p=2991";
		else if (iIndex == 13) site = "../main.php?t=article&p=2338";
		else if (iIndex == 14) site = "../main.php?t=article&p=2308";
		self.location.href = site;
	}

	function pageMaintaining(iIndex) {
		if (iIndex == 0) site = "";
		//else if (iIndex == 1) site = "/shared/hras/areuatrisk/hra.asp";
		else if (iIndex == 2) site = "../main.php?t=article&p=3086";
		else if (iIndex == 3) site = "../main.php?t=article&p=2267";
		else if (iIndex == 4) site = "../main.php?t=article&p=2306";
		else if (iIndex == 5) site = "../main.php?t=article&p=2389";
		else if (iIndex == 6) site = "../main.php?t=article&p=3096";
		else if (iIndex == 7) site = "../main.php?t=article&p=2329";
		else if (iIndex == 8) site = "../main.php?t=article&p=2320";
		else if (iIndex == 9) site = "../main.php?t=article&p=2295";
		else if (iIndex == 10) site = "../main.php?t=article&p=2310";
		self.location.href = site;
	}

	function changePage(iIndex) {
		if (iIndex == 1) site = "../main.php?t=symptom&p=anatomy_explorer";
		else if (iIndex == 2) site = "../calc.php?p=bmi";
		else if (iIndex == 3) site = "../main.php?t=symptom&p=ready_when_you_are";
		else if (iIndex == 4) site = "../main.php?t=sos&p=default";
		else if (iIndex == 5) site = "../main.php?t=center&p=default";


		if (iIndex != 0) self.location.href = site;
	}
	

function replaceSubstring(inputString, fromString, toString) {
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function

 function Trim(TRIM_VALUE){


        	if(TRIM_VALUE.length < 1){
        		return"";
        	}
        	TRIM_VALUE = RTrim(TRIM_VALUE);
        	TRIM_VALUE = LTrim(TRIM_VALUE);


            	if(TRIM_VALUE==""){
            		return "";
            	}


                	else{
                		return TRIM_VALUE;
                	}
            }


function RTrim(VALUE){
                	var w_space = String.fromCharCode(32);
                	var v_length = VALUE.length;
                	var strTemp = "";


                    	if(v_length < 0){
                    		return"";
                    	}
                    	var iTemp = v_length -1;


                        	while(iTemp > -1){
                        		if(VALUE.charAt(iTemp) == w_space){}


                            		else{
                            			strTemp = VALUE.substring(0,iTemp +1);
                            			break;
                            		}
                            		iTemp = iTemp-1;
                            	}
                            	return strTemp;
     }


  function LTrim(VALUE){
                            	var w_space = String.fromCharCode(4);


                                	if(v_length < 1){
                                		return"";
                                	}
                                	var v_length = VALUE.length;
                                	var strTemp = "";
                                	var iTemp = 0;


                                    	while(iTemp < v_length){
                                    		if(VALUE.charAt(iTemp) == w_space){}


                                        		else{
                                        			strTemp = VALUE.substring(iTemp,v_length);
                                        			break;
                                        		}
                                        		iTemp = iTemp + 1;
                                        	}
                                        	return strTemp;
     }

myname=document.location.href;
myname=replaceSubstring(myname,"http://www.discoveryhospital.com","")
myname1=myname.substring(0,5);

