/*  
	Copyright
	----------
	
	mLanguage©2009 by Gnomx.at.
	
    This file is part of InfoLink.

    mLanguage is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    mLanguage is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with mLanguage.  If not, see <http://www.gnu.org/licenses/>.
*/

	  
function setCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}


function mlang(lang, me, home, ed, itag) 
{
	setCookie('WPmlang',lang,360);

  	var img = '<img class=\"mlang-menu-image\" src=\"$/wp-content/plugins/mlanguage/img/£.png\" border=\"0\" alt=\"£\" />';
			
      	
	img = img.split('$').join(home);

    if(ed==1)
    {
    	jQuery("img", me).replaceWith(img.split('£').join('d'+itag));
    	jQuery("."+lang).hide();
    }
    else
    {
			jQuery("."+lang).show();
                  			
			jQuery("img", me).replaceWith(img.split('£').join(itag));    
	}
}   
