// JavaScript Document
// JavaScript Document
//loadjscssfile("styles/icon-style.css", "css") 
$(function(){
	placeIcon()
	//pubAni()
	//homePubScroll()
	})


function placeIcon(){
	$("a[href$='.pdf']").filter(function(){return !($(this).hasClass('noIcon'))})
	.append(" <img src='images/iconStyle/pdf.png' border='0'  align='absmiddle'/>")
	.attr("title","This is a PDF Document & open in a new window");
	// Add txt icons to document links (doc, rtf, txt)
	$("a[href$='.doc'], a[href$='.txt'], a[href$='.rft'],").filter(function(){return !($(this).hasClass('noIcon'))})
	.append(" <img src='images/iconStyle/txt.png' border='0' align='absmiddle'/>")
	.attr("title","This is a DOC Document & open in a new window");
	
	$("a[href$='.xls']").filter(function(){return !($(this).hasClass('noIcon'))})
	.append(" <img src='images/iconStyle/xls.jpg' border='0' align='absmiddle'/>")
	.attr("title","This is a DOC Document & open in a new window");
	
	$("a[href$='.PPT'], a[href$='.ppt']").filter(function(){return !($(this).hasClass('noIcon'))})
	.append(" <img src='images/iconStyle/ppt.png' border='0' align='absmiddle'/>")
	.attr("title","This is a PPT Document & open in a new window");


	// Add zip icons to Zip file links (zip, rar)
	$("a[href$='.zip'], a[href$='.rar']").filter(function(){return !($(this).hasClass('noIcon'))}).append(" <img src='images/iconStyle/zip.png' border='0' align='absmiddle'/>"); 
	
	// Add email icons to email links
	$("a[href^='mailto:']").filter(function(){return !($(this).hasClass('noIcon'))}).append(" <img src='images/iconStyle/email.png' border='0' align='absmiddle'/>"); 

	//Add external link icon to external links - 
	$('a').filter(function() {
		//Compare the anchor tag's host name with location's host name
	    return this.hostname && this.hostname !== location.hostname;
	  }).filter(function(){return !($(this).hasClass('noIcon'))})
	.append(" <img src='images/iconStyle/ext_link.png' border='0' align='absmiddle'/>")
	.attr("title","This link opens in a new window");
	}

function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}

//var showCount=0
//
//function pubAni(){
//	
//	if($("#fade div")){
//		$("#fade div").fadeOut("slow")
//		$("#fade div").hide()
//		}
//	$("#fade div:eq("+showCount+")").fadeIn("slow")
//	showCount++	
//	if(showCount>2)
//	showCount=0
//	}
//	
//function homePubScroll(){
//setInterval('pubAni();',3000); 
//}