
/*<!-- *** Share fly-out *** -->  */
$(document).ready(function() {
    $('#shareExpanded').hide();
    // shows the box on clicking the noted link
    $('li#shareLink').click(function() {
        $('#shareExpanded').slideDown('normal');
        return false;
      });
     // hides the box on clicking the noted link
    $('a#shareClose').click(function() {
        $('#shareExpanded').slideUp('normal');
         return false;
      });
});

function sendToPhoneSetup(contentId, parentId, title, date, address, contactPhone, link, whichSite)
{
    var sendPhoneInfo = "sendPost=false" +"&whichSite=" + whichSite + "&name=" + escape(title);
    if(date!=""){ 
        sendPhoneInfo = sendPhoneInfo + "&date=" + escape(date);
    }
    
    sendPhoneInfo = sendPhoneInfo + "&emailPost=false" + "&addr=" + escape(address) + "&contactphone=" + contactPhone + "&path=" + link; 
    var sendToPhoneLink = "http://" + location.host + "/sendtophone?" + sendPhoneInfo;

    sendtophone(contentId, parentId);
    GB_show("",sendToPhoneLink,200,410);
    return false;
}
   
function sendEmailSetup(contentId, parentId, link, subject, body, whichSite)
{
	var append = "";
	if (polopoly.user.isLoggedIn()) { 
		append = "&sender=" + polopoly.user.name() + "&loggedIn=yes";
	} else { 
		append = "&loggedIn=no";
	} 	
  	var sendEmailLink;
  	if (append!="") {
  		sendEmailLink = "http://" + location.host + "/emailarticle?" + "&emailPost=false" + "&whichSite=" + whichSite + "&path=" + link + "&title=" + subject + "&body=" + body + append;
  	} else {
		sendEmailLink = "http://" + location.host + "/emailarticle?" + "&emailPost=false" + "&whichSite=" + whichSite + "&path=" + link + "&title=" + subject + "&body=" + body;
  	}	
  	emailArticle(contentId, parentId);
    GB_show("", sendEmailLink, 440, 510);
    
    return false;
}

/*<!--  *** email a friend *** -->*/
/*<!--  the function below requires  http://jquery.com/src/latest  and greybox.js  -->*/

 function emailArticle(a,d) {       
	    var newdiv = document.createElement('div');
	    var imgContent = '<img src="http://' + location.host + '/logger/p.gif?type=EMAILED&a=' + a + '&d=/' + d + '" />';                    
	    newdiv.innerHTML = imgContent;
	    document.body.appendChild(newdiv);
	    return false;
 }
	 
/* <!--  end email a friend  -->*/
	 
/* *** Send to Phone *** */

	 function sendtophone(a,d) {       
	    var newdiv = document.createElement('div');
	    var imgContent = '<img src="http://' + location.host + '/logger/p.gif?type=EMAILED&a=' + a + '&d=/' + d + '" />';                    
	    newdiv.innerHTML = imgContent;
	    document.body.appendChild(newdiv);
	    return false;
	 }

/* *** end Send to Phone *** */
 
/* comments */
 function openPopup(url) {
     if (url.href) {
         url = url.href;
     }
     var win = window.open(url,'popup','width=500,height=320,menubar=no,location=no,resizable=yes,scrollbars=no');
     if (win) {
         win.focus();
     }
     return false;
 }

 function clearField(el) {
     if (el.value == el.defaultValue) el.value = '';
 }

 function resetField(el) {
     if (el.value == '') el.value = el.defaultValue;
 }

 function viewAllComments() {
     document.comments.submit();return false;
 }

 function submitComment(obj)
 {
     obj.action=obj.formURL.value;
     obj.submit();
     viewAllComments();
 }

 function viewAllCommentsWithPostCommentOpen() {
     document.commentsOpenPost.submit();return false;
 }
//<!-- end comments -->
 
//<!-- article font size change  --> 
 var min=100;
 var max=200;
 function increaseFontSize() {
    var p = document.getElementById("primary").getElementsByTagName('p');
    for(i=0;i<p.length;i++) {
       if(p[i].style.fontSize) {
          var s = parseInt(p[i].style.fontSize.replace("%",""));
       } else {
          var s = 100;
       }
       if(s!=max) {
          s += 20;
       }
       p[i].style.fontSize = s+"%"
    }
 }
 function decreaseFontSize() {
    var p = document.getElementById("primary").getElementsByTagName('p');
    for(i=0;i<p.length;i++) {
       if(p[i].style.fontSize) {
          var s = parseInt(p[i].style.fontSize.replace("%",""));
       } else {
          var s = 100;
       }
       if(s!=min) {
          s -= 20;
       }
       p[i].style.fontSize = s+"%"
    }   
 }
      
 /* GLOBAL OMNITURE VARIABLES */
 s_nd_events="" ;

 
 /* ClueTip Initialize */  
 $(document).ready(function() {$('a.tips').cluetip();$('a.tips-width').cluetip({width: '385px', showTitle: true});$('a.tips-sticky').cluetip({sticky: true, closePosition: 'title', arrows: true});});
 
