<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
  <ModulePrefs title="Publicitas Media Search" description="Publicitas provides a powerful search engine to easily access key information about more than 20'000 all-media publications worldwide."
	author="Publicitas S.A. (a Publigroupe Company)" author_email="webmaster@publicitas.com" 
	screenshot="http://www.publicitas.com/fileadmin/uploads/crm/InternalServices/PublicitasMSWidgetImage.png" author_location="Switzerland" 
	thumbnail="http://www.publicitas.com/fileadmin/uploads/crm/InternalServices/PublicitasMSWidgetThumbnail.png" author_affiliation="Publicitas" 
	title_url="http://www.google.com/ig/directory?type=gadgets&amp;url=widget.publicitas.com/SearchWidgetServices/pmediasearch.xml" directory_title="Publicitas Media Search" 
	author_photo= "http://www.publicitas.com/fileadmin/uploads/crm/InternalServices/PublicitasMSVertical100px.png"
	author_aboutme= " Publicitas understands international media. Through our network of 60 sales outlets in 23 countries, we offer our advertising customers a simplified and centralized access to the most prestigious media in over 100 countries. We bring our media partners closer to the customer."
	author_link="http://www.publicitas.com/"
	author_quote="the leading transnational media representative"
	category="communication" category2="tools"
	height="150"> 
    <Require feature="dynamic-height"/>
    <Require feature="analytics"/>
</ModulePrefs>
  <Content type="html">
  <![CDATA[
  <head>
	<link rel="stylesheet" type="text/css" href="http://widget.publicitas.com/SearchWidgetServices/widgetstyles_v12.css" media="all">
	<link rel="stylesheet" type="text/css" href="http://widget.publicitas.com/SearchWidgetServices/tabstyles_XML_v11.css" media="all">
	<script src="http://widget.publicitas.com/SearchWidgetServices/scripts/jquery-1.3.2.min.js"></script>
	<!--<script type="text/javascript">
		$(document).ready(function(){
			$('#tabs div').hide(); // Hide all divs
			$('#tabs div:first').show(); // Show the first div
			$('#tabs ul li:first').addClass('active'); // Set the class of the first link to active
			var currentTab;
			$('#tabs ul li a').click(function (){ //When any tablink is clicked
				$('#tabs ul li').removeClass('active'); // Remove active class from all tablinks
				$(this).parent().addClass('active'); //Set clicked tablink class to active
				currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked tablink
				$('#tabs div').hide(); // Hide all divs
				$('#tabs div div').show();
				$(currentTab).show(); // Show div with id equal to variable currentTab
				_IG_AdjustIFrameHeight();
				return false;
			});
		});
	</script>-->
	<script type="text/javascript">
		_IG_Analytics("UA-393544-11", "/pmediasearch.xml");
		var browser=navigator.appName;
	</script>
  	<script type="text/javascript">
	    // This example lets users add items to a grocery list and then clear the list.
	    // When items are added or cleared, the gadget resizes itself.
	    var mylist1 = "";
	    var flag = 0;
	
	function search (form) {
		addToList(form, "all", 1);
	}
	    // Function that is invoked whenever user clicks the Add button to add an
	    // item to the list.
    function addToList (form, tabName, pageNr) {
    	if (form == null) {
    		var input = "samethanbefore";
    	}
    	else {	
	        var input = _trim(form.inputbox.value);
        }
	        if (input == "") {
	            return;
	        }
	    //mylist1 = "";
	        var i = 0;
	        var nbPages = 1;
	        
	        $(document).ready(function(){
	    	$.getJSON("http://widget.publicitas.com/SearchWidgetServices/SimpleJsonSearch?callback=?&query=" + escape(input) + "&tabname=" + tabName +  "&pagenr=" + pageNr,
		        function(data){
		        if (data.nbAllObjects > 0) {
		          $('#tabs div:first').show(); // Show the first div
		          $('#footerlogodiv').hide();
		          $('#bottomtext').hide();
		          $('#tabs').show();
		          //$('#tabs div').hide(); // Hide all divs
				  $('#tabs ul li').removeClass('active');
				  //$('#tabs ul li:first').addClass('active');
		          $('#nomatch').hide();
		          $('#refinesearch').hide();
				  $('#iesecurity').hide();
		          if (data.nbNewspapers == 0) {$('#tabNewspaper p').show();$('#tabNewspaper a').hide();}
		          else {$('#tabNewspaper a').show();$('#tabNewspaper p').hide();}
		          if (data.nbMagazines == 0) {$('#tabMagazine p').show();$('#tabMagazine a').hide();}
		          else {$('#tabMagazine a').show();$('#tabMagazine p').hide();}
		          if (data.nbOnlines == 0) {$('#tabOnline p').show();$('#tabOnline a').hide();}
		          else {$('#tabOnline a').show();$('#tabOnline p').hide();}
		          if (data.nbOthers == 0) {$('#tabOther p').show();$('#tabOther a').hide();}
		          else {$('#tabOther a').show();$('#tabOther p').hide();}
		          
		          if (tabName == 'all') {
		          	$('#tabAll').addClass('active');
		          	nbPages = Math.ceil(data.nbAllObjects / 10);
		          } else if (tabName == 'newspaper') {
		          	$('#tabNewspaper').addClass('active');
		          	nbPages = Math.ceil(data.nbNewspapers / 10);
		          } else if (tabName == 'magazine') {
		          	$('#tabMagazine').addClass('active');
		          	nbPages = Math.ceil(data.nbMagazines / 10);
		          } else if (tabName == 'online') {
		          	$('#tabOnline').addClass('active');
		          	nbPages = Math.ceil(data.nbOnlines / 10);
		          } else {
		          	$('#tabOther').addClass('active');
		          	nbPages = Math.ceil(data.nbOthers / 10);
		          }
		          
		          $.each(data.currentPageItems, function(i,item){
					mylist1 += "<p><a href=\"" + item.link + "\" target=\"_blank\"><b>" + item.publicationName + "</b><br/>" + item.publicationType + ", " + item.country + ", " + item.frequency + ", " + item.language + "</a></p>";}
		          );
		          setContent(mylist1, 'tab-result', nbPages, tabName, pageNr);
		          mylist1 = ""; 
		          i = 0;nbPages = 1;
		          $('#footerlogodiv').show();
				  $('#bottomtext').show();
				  _IG_AdjustIFrameHeight();
			         } else {
			         	$('#tabs').hide();
			         	$('#nomatch').show();
			         	$('#refinesearch').show();
			         	if (browser == 'Microsoft Internet Explorer') {
							$('#iesecurity').show();
						}
			         	_IG_AdjustIFrameHeight();
			         }
			         $('#tabs div div ul li a').click(function (){ //When any tablink is clicked
						 var currentResPage = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked tablink
						 currentResPage = currentResPage.substr(currentResPage.lastIndexOf('#'), currentResPage.length);
						 $('#tabs div div').show();
						 $(currentResPage).show(); // Show div with id equal to variable currentTab
						 _IG_AdjustIFrameHeight();
						 return false;
					});
		        });
		  });
	    }
    // Clear the list
    function clearList(form) {
        // Call setContent to remove all items from the list and resize the gadget
        setContent("", 'tab-result');
    }
    
    function getFooter(divId, pageNr, nbPages) {
	    	var footer = "";
	    	var loopcount = 0;
	    	if (nbPages > 1) {
	    		footer += "<div class=\"tab_footer\" style=\"display: block;\"><ul>";
    		if (pageNr > 1) {
    			footer += "<li><a href=\"javascript:;\" id=\"prev\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + (pageNr - 1) + ")\">Previous</a></li>";
    			footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 1)\">1</a></li>";
    			if (pageNr == 2) {
    				footer += "<li>,&nbsp;</li>";
    				footer += "<li class=\"selection\">2</li>";
    				if (nbPages > 2) {
    					footer += "<li>,&nbsp;</li>";
    					footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 3)\">3</a></li>";
    					if (nbPages == 4) {
    						footer += "<li>,&nbsp;</li>";
    						footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 4)\">4</a></li>";
    					} else if (nbPages > 4) {
    						footer += "<li>, ...,&nbsp;</li>";
    						footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + nbPages + ")\">" + nbPages + "</a></li>";
    					}
    					footer += "<li><a href=\"javascript:;\" id=\"next\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + (pageNr + 1) + ")\">Next</a></li>";
    				} else {
    					footer += "<li id=\"next\" class=\"inactive\">Next</li>";
    				}
    			} else if (pageNr == 3) {
    				footer += "<li>,&nbsp;</li>";
    				footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 2)\">2</a></li>";
    				footer += "<li>,&nbsp;</li>";
    				footer += "<li class=\"selection\">3</li>";
    				if (nbPages == 4) {
    					footer += "<li>,&nbsp;</li>";
    					footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 4)\">4</a></li>";
    					footer += "<li><a href=\"javascript:;\" id=\"next\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + (pageNr + 1) + ")\">Next</a></li>";
    				} else if (nbPages > 4) {
    					footer += "<li>,&nbsp;</li>";
    					footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 4)\">4</a></li>";
    					if (nbPages == 5) {
    						footer += "<li>,&nbsp;</li>";
    						footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 5)\">5</a></li>";
    					} else {
    						footer += "<li>, ...,&nbsp;</li>";
    						footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + nbPages + ")\">" + nbPages + "</a></li>";
    					}
    					footer += "<li><a href=\"javascript:;\" id=\"next\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + (pageNr + 1) + ")\">Next</a></li>";
    				} else {
    					footer += "<li id=\"next\" class=\"inactive\">Next</li>";
    				}
    			} else {
    				footer += "<li>, ...,&nbsp;</li>";
    				footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + (pageNr - 1) + ")\">" + (pageNr - 1) + "</a></li>";
    				footer += "<li>,&nbsp;</li>";
    				footer += "<li class=\"selection\">" + pageNr + "</li>";
    				if (pageNr < nbPages) {
    					footer += "<li>,&nbsp;</li>";
    					footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + (pageNr + 1) + ")\">" + (pageNr + 1) + "</a></li>";
    					if ((pageNr + 2) == nbPages) {
    						footer += "<li>,&nbsp;</li>";
    						footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + (pageNr + 2) + ")\">" + (pageNr + 2) + "</a></li>";
    					} else if ((pageNr + 2) < nbPages) {
    						footer += "<li>, ...,&nbsp;</li>";
    						footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + nbPages + ")\">" + nbPages + "</a></li>";
    					}
    					footer += "<li><a href=\"javascript:;\" id=\"next\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + (pageNr + 1) + ")\">Next</a></li>";
    				} else {
    					footer += "<li id=\"next\" class=\"inactive\">Next</li>";
    				}
    			}
    		} else {
    			footer += "<li id=\"prev\" class=\"inactive\">Previous</li>";
    			footer += "<li class=\"selection\">1</li>";
    			footer += "<li>,&nbsp;</li>";
    			footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 2)\">2</a></li>";
    			if (nbPages > 2) {
    				footer += "<li>,&nbsp;</li>";
    				footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 3)\">3</a></li>";
    				if (nbPages > 4) {
    					footer += "<li>, ...,&nbsp;</li>";
    					footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + nbPages + ")\">" + nbPages + "</a></li>";
    				} else if (nbPages == 4) {
    					footer += "<li>, </li>";
    					footer += "<li><a href=\"javascript:;\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', 4)\">4</a></li>";
    				}
    			}
    			footer += "<li><a href=\"javascript:;\" id=\"next\" class=\"clickableLink\" onclick=\"addToList(null, \'" + divId + "\', " + (pageNr + 1) + ")\">Next</a></li>";
    		}
    		footer += "</div>";
    	}
	    	return footer;
	    }
	
	    // Outputs content to the div and resizes the gadget
    function setContent(html, divId, nbPages, tabName, pageNr) {
	    	_gel(divId).innerHTML = html + getFooter(tabName, pageNr, nbPages);
	       // Tells gadget to resize itself
	       //_IG_AdjustIFrameHeight();
	    }
	    
	    function handleEnter(formular, e) {
	    var charCode;
	    
	    if(e && e.which){
	        charCode = e.which;
	    }else if(window.event){
	        e = window.event;
	        charCode = e.keyCode;
	    }
	
	    if(charCode == 13) {
	        search(formular);
	    }
	}
	    </script>
	  </head>
	<body onload="_IG_AdjustIFrameHeight();">
		<div id="content">
		  <FORM NAME="myform" ACTION="javascript:onSubmit" METHOD="GET" onSubmit="search(this)"><BR>
			<input TYPE="text" NAME="inputbox" VALUE="" maxlength="100" size="32" title="Type your search criteria here, for example: fashion french magazine. Main supported operators: AND, «  », ?, *… (see help for further information).">
			<input TYPE="button" NAME="button" Value="Search" onClick="search(this.form)">
		  </FORM>
		</div>
		<div id="help"><a href=" http://www.publicitas.com/global/services/mediasearchwidget/widget-help/" target="_blank">Need help? <u>Click Here</u></a></div>
	<div id="advsearch"><a href="http://www.publicitas.com/global/services/media-search/" target="_blank"><u>Advanced Search</u></a></div>
		<div id="tabs" style="display:none;">
			<ul>
			<li id="tabAll" class="tabli"><a class="tab" href="javascript:;" onclick="addToList(null, 'all', 1)">All</a></li>
			<li id="tabNewspaper" class="tabli"><p>Newspaper</p><a class="tab" href="javascript:;" onclick="addToList(null, 'newspaper', 1)">Newspaper</a></li>
			<li id="tabMagazine" class="tabli"><p>Magazine</p><a class="tab" href="javascript:;" onclick="addToList(null, 'magazine', 1)">Magazine</a></li>
			<li id="tabOnline" class="tabli"><p>Online</p><a class="tab" href="javascript:;" onclick="addToList(null, 'online', 1)">Online</a></li>
			<li id="tabOther" class="tabli"><p>Other</p><a class="tab" href="javascript:;" onclick="addToList(null, 'other', 1)">Other</a></li>
			</ul>
		<div id="tab-result"></div>
	</div>
	<div id="nomatch" style="display:none;">Your criteria doesn't match any media in our database</div>
	  	<div id="refinesearch" style="display:none;">Check your spelling or try different keywords.<br>If you wish to speak to an expert directly, feel free to contact your closest <a href="http://www.publicitas.com/en/global/offices-network/location-finder" target="_blank"/>Publicitas office</a>.</div>
	  	<div id="iesecurity" style="display:none;">For an optimal media search, please add www.publicitas.com in your trusted sites (Tools / Internet Options / Security / Trusted Sites)</div>
	  	<div id="footerlogodiv">
			<a id="footerlogo" target="_blank" href="http://www.publicitas.com/en/global/">
				<img src="http://widget.publicitas.com/SearchWidgetServices/images/logoanim_RGB_104px.gif" alt="Publicitas media search widget" title="Publicitas media search widget"/>
			</a>
		</div>
		<div id="bottomtext">We know media</div>
	</body>
  ]]>
  </Content>
</Module>

