//window.onerror = function(){ return true; }

/*
window.onresize=resize;
function resize(){
self.location.href=self.location.href;
}
*/

/********** FOR DYNAMIC SUBNAV ************/

function hideDefault(){
    document.getElementById(curMenu).style.display='none';
}

function showDefault(){
    var theDiv = document.getElementById(curMenu);
     var theNav = new Array("blanky","per","bus","conv","eli","car","abo");
     var i = 0;
     for (i=0;i<7;i++) {
     
         document.getElementById(theNav[i]).style.display='none';
     }
     if(theDiv) {
    document.getElementById(curMenu).style.display='block';
    }
}

function showMenu(theDiv) {
var theN = new Array("blanky","per","bus","conv","eli","car","abo");
     var i = 0;
     for (i=0;i<7;i++) {
         document.getElementById(theN[i]).style.display='none';
     }
          clearTimeout(itsHidden); 
          itsHidden=0;
         hideDefault();
         document.getElementById(theDiv).style.display='block';
}

function hideSubnav(theHider,to,fromWhere) {
              if (!to) {to = 1000;}
              if ((fromWhere != 'main') && (theHider != curMenu)) { to = 80; }
              var hideThis = {
                    off: function() {
                        document.getElementById(theHider).style.display='none';
                        showDefault();
                        clearTimeout(itsHidden); 
                        itsHidden=0;
                    }
}
              //hideMe = new hideThis;
              //hideMe.currentDiv = theHider;
                
                itsHidden = setTimeout(hideThis.off,to);
}

function hideTheThing(theHider) {
    document.getElementById(theHider).style.display='none';
    showDefault();
}


/***************************************************/
function target_blank(url){
    tmp = window.open(url);
    tmp = null;
}

document.write('<img src="'+dir+'/images/wcscreenrez.gif?width='+screen.width+'&height='+screen.height+'" width="1" height="1" />'); 

function wcInternalPopup(url, height, width){
    var wide=width;
    var tall=height;
    var halfwide = (wide/2);
    var halftall = (tall/2);
    var pWidth = ( ((parseInt(screen.width) / 2)) - halfwide);
    var pHeight = (((parseInt(screen.height) / 2)) - halftall);
    var features = 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width='+wide+',height='+tall+',top='+pHeight+',left='+pWidth;
    window.open(url,'internalpopup',features);
} 

function wcPopup(url, height, width, disclaimer){
    var wide=width;
    var tall=height;
    var halfwide = (wide/2);
    var halftall = (tall/2);
    var pWidth = ( ((parseInt(screen.width) / 2)) - halfwide);
    var pHeight = (((parseInt(screen.height) / 2)) - halftall);
    var features = 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width='+wide+',height='+tall+',top='+pHeight+',left='+pWidth;
    window.open(url,'externalpopup',features);
}

/*function open_apps(nameofapp)
{
var pWidth = ( ((parseInt(screen.width) / 2)) - 350)
var pHeight = (((parseInt(screen.height) / 2)) - 300)
aWindow = window.open('https://www.usfed.org/Forms/OnlineForm.cgi?form=' + nameofapp,'application',"toolbar=0,location=0,directories=0,status=0,menubar=0,width=700,height=600,top=" + pHeight + ",left=" + pWidth + ",scrollbars=1,resizable=1,status=1");
}*/

function openPDF(page){
	bWindow = window.open(fiDir + 'fiFiles/static/documents/'+page);
	bWindow = null;
}

function openDisc(page)
{
var pWidth = ( ((parseInt(screen.width) / 2)) - 300)
var pHeight = (((parseInt(screen.height) / 2)) - 400)
bWindow = window.open(page,'discwin',"scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,width=600,height=600,top=" + pHeight + ",left=" + pWidth);
	bWindow = null;
}

/************************************************************************************************************
* This function is used in the onclick of the a tag to display the external site warning. 
* @param msg - Integer specifying the which message to display.
* @param lk - The a link object
* Usage: <a href="http://wwww.mysite.com" onclick="return displayThirdPartyAlert(1,this);">My Site</a>
**************************************************************************************************************/
function displayThirdPartyAlert(msg,lk){
	var description = lk.innerHTML;
	if(description.indexOf('alt="') != -1){
		var x = description.indexOf('alt="')+5;
		var temp = description.substring(x);
		description = temp.substring(0,temp.indexOf("\""));
	}
	showWarning(lk.href, description, lk.target, msg)
	return false;
}

/************************************************************************************************************
* This function is used in the href of the a tag to display the external site warning. 
* @param lk - The url of the site to be opened
* @param desc - The description of the site to be opened, i.e. the name of the site.
* @param target - Allows for the window to opened in a new window
* @param msg - Integer specifying the which message to display.
* Usage: <a href="javascript:('http://wwww.mysite.com');">My Site</a>
**************************************************************************************************************/

function showWarning(lk, desc, target, msg){
	desc = (desc) ? desc : "Third Party Site";
	//target = (target) ? target : "_blank";
	msg = (msg) ? msg : 0;
	
	var messages = new Array(6);
    messages[0] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2><p>You are leaving '+fiName+'\'s website. Links that may be accessed via this site are for the convenience of informational purposes only. Any products and services accessed through this link are not provided or guaranteed by '+fiName+'. The site you are about to visit may have a privacy policy that is different than '+fiName+'\'s. Please review their privacy policy. '+fiName+' does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.</p>';
    messages[1] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2><p>You are leaving '+fiName+'\'s website. Links that may be accessed via this site are for the convenience of informational purposes only. Any products and services accessed through this link are not provided or guaranteed by '+fiName+'. The site you are about to visit may have a privacy policy that is different than '+fiName+'\'s. Please review their privacy policy. '+fiName+' does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.</p>';
    messages[2] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2><p>You are leaving South Carolina Federal\'s website. The site you are about to visit may have a privacy policy that is different than South Carolina Federal\'s. Please review their privacy policy. </p><p>Important Disclaimer: The use of TurboTax is governed by Intuit\'s software licensing agreement. Intuit, TurboTax and TurboTax Online, among others, are registered trademarks and/or service marks of Intuit Inc. in the United States and other countries and are used with permission. Intuit is not affiliated with '+fiName+'. Intuit is solely responsible for the information, content and software products provided by Intuit. '+fiName+' has not been involved in the preparation of the content provided by Intuit and does not explicitly or implicitly endorse or approve such content. '+fiName+' cannot guarantee that the information and content supplied is accurate, complete, or timely, or that the software products provided produce accurate and/or complete results. '+fiName+' does not make any warranties with regard to the information, content or software products or the results obtained by their use. '+fiName+' disclaims any liability arising out of your use (or the results obtained from, interpretations made as a result of, or any tax position taken in reliance on information provided pursuant to, your use) of these Intuit software products or the information or content furnished by Intuit.</p>';
    messages[3] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2><p>You are leaving '+fiName+'\'s website. Links that may be accessed via this site are for the convenience of informational purposes only. Any products and services accessed through this link are not provided or guaranteed by '+fiName+'. The site you are about to visit may have a privacy policy that is different than '+fiName+'\'s. Please review their privacy policy. '+fiName+' does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.</p>';
    messages[4] = '<h2 style="text-align:center">Third Party Site Disclaimer</h2><p>You are leaving '+fiName+'\'s website. Links that may be accessed via this site are for the convenience of informational purposes only. Any products and services accessed through this link are not provided or guaranteed by '+fiName+'. The site you are about to visit may have a privacy policy that is different than '+fiName+'\'s. Please review their privacy policy. '+fiName+' does not endorse the content contained in these sites, nor the organizations publishing those sites, and hereby disclaims any responsibility for such content.</p>';
    messages[5] = '<h2 style="text-align:center">E-mail Disclaimer</h2><p>WARNING: E-mail is an unsecure method of communication.  Any information contained in your message could be viewed by a third party.  Sensitive information such as passwords or social security numbers should be omitted from e-mail messages.</p>';

	var content = new Array();
	var index = 0;
	content[index++] = messages[msg];
	content[index++] = '<br /><br />';
	content[index++] = '<div align="center"><a href="'+lk+'" target="'+target+'" onclick="document.getElementById(\'ex_dis\').style.display = \'none\'">Continue</a>&#160;&#160;<a href="javascript:void(\'0\');" onclick="document.getElementById(\'ex_dis\').style.display = \'none\'">Decline</a></div></div>';	
    // turbotax banner is very tall, and gets covered by the dropdown select boxes.  Easy fix was just to move it up (instead of hiding all select boxes when displaying a popup div)
    if (msg == 2) {
        $("#ex_dis").css("top","5px"); // move it up only 20px from top
    } else {
        $("#ex_dis").css("top","139px"); // default top value from _styles.css
    }
	document.getElementById("ex_dis").innerHTML = content.join("");
	document.getElementById("ex_dis").style.display = "block";
	scrollTo(0,0);
}

function warn_cm(){
	
	var message;
               message = '<h2 style="text-align:center">Coming Soon</h2><p>This service is under development.  Please contact a Business Service Officer at 843-569-4961 for more information.</p>';
    
	var content = new Array();
	var index = 0;
	content[index++] = message;
	content[index++] = '<br /><br />';
	content[index++] = '<div align="center"><a href="javascript:void(\'0\');" onclick="document.getElementById(\'ex_dis\').style.display = \'none\'">Close</a></div></div>';	
	document.getElementById("ex_dis").innerHTML = content.join("");
	document.getElementById("ex_dis").style.display = "block";
	scrollTo(0,0);
}


function getUrl(){
	var url = document.location.href;
	var urlstart = url.indexOf("newUrl=") + 7;
	var urlToReturn = url.substring(urlstart);
	return urlToReturn;
}

function goto(srcElement)
{
    var url = srcElement.value
    var dest = (/^http:/i.test(url)||/^javascript:/i.test(url)?'':'/home/')+url;
    if (url != '') document.location.href = dest;
}

//INCREASE FONT
var max=18;
function increaseFontSize() {
   var d = document.getElementsByTagName('div');
   for(i=0;i<d.length;i++) {
      if(d[i].style.fontSize) {
         var s = parseInt(d[i].style.fontSize.replace("px",""));
      } else {
         var s = 10;
      }
      if(s!=max) {
         s += 1;
      }
      d[i].style.fontSize = s+"px"
   }
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var t = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var t = 10;
      }
      if(t!=max) {
         t += 1;
      }
      p[i].style.fontSize = s+"px"
   }
   
  var li = document.getElementsByTagName('li');
   for(i=0;i<li.length;i++) {
      if(li[i].style.fontSize) {
         var u = parseInt(li[i].style.fontSize.replace("px",""));
      } else {
         var u = 10;
      }
      if(u!=max) {
         u += 1;
      }
      li[i].style.fontSize = s+"px"
   }
   
   var td = document.getElementsByTagName('td');
   for(i=0;i<td.length;i++) {
      if(td[i].style.fontSize) {
         var x = parseInt(td[i].style.fontSize.replace("px",""));
      } else {
         var x = 10;
      }
      if(x!=max) {
         x += 1;
      }
      td[i].style.fontSize = s+"px"
   }
   
}



//DECREASE FONT

var min=8;
function decreaseFontSize() {
   var d = document.getElementsByTagName('div');
   for(i=0;i<d.length;i++) {
      if(d[i].style.fontSize) {
         var s = parseInt(d[i].style.fontSize.replace("px",""));
      } else {
         var s = 10;
      }
      if(s!=min) {
         s -= 1;
      }
      d[i].style.fontSize = s+"px"
   }   
   
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var t = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var t = 10;
      }
      if(t!=min) {
         t -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
   var li = document.getElementsByTagName('li');
   for(i=0;i<li.length;i++) {
      if(li[i].style.fontSize) {
         var u = parseInt(li[i].style.fontSize.replace("px",""));
      } else {
         var u = 10;
      }
      if(u!=min) {
         u -= 1;
      }
      li[i].style.fontSize = s+"px"
   }   
   
   var td = document.getElementsByTagName('td');
   for(i=0;i<td.length;i++) {
      if(td[i].style.fontSize) {
         var x = parseInt(td[i].style.fontSize.replace("px",""));
      } else {
         var x = 10;
      }
      if(x!=min) {
         x -= 1;
      }
      td[i].style.fontSize = s+"px"
   }   
}

function tagReplace(str)
{
	var result = (str == "") ? "&#160;" : str;
	return result.replace(/\(br\)/gi, "<br />")
					.replace(/\(sup\)/gi, "<sup>")
					.replace(/\(\/sup\)/gi, "</sup>")
					.replace(/\(rate_highlight\)/gi, '<span class="rate_highlight">')
					.replace(/\(\/rate_highlight\)/gi, "</span>");
}

//end of file