function fonload(){
if(document.getElementById("q")){
document.getElementById("q").focus();
}
}

function check_form(text_id,form_id){
if (document.getElementById(text_id).value == ''){
alert ('Please fill in the search text.');
document.getElementById(text_id).focus();
}
else {
document.getElementById(form_id).submit();
}
}

/////////////////drop down button 1/////////////////
var CrawlerURL = 'http://portal.crawler.com/search/disp.aspx'
label = new Array()

label [1] = "Search the Web";
label [2] = "Search for Images";
label [3] = "Search in Groups";
label [4] = "Search the News";
label [5] = "Search in Shopping";
//label [6] = "Search in Local";

action = new Array()
action [1] = CrawlerURL
action [2] = CrawlerURL
action [3] = CrawlerURL
action [4] = CrawlerURL
action [5] = CrawlerURL
//action [6] = "javascript: alert('Search in Local');";

cat = new Array()
cat [1] = 'web';
cat [2] = 'images';
cat [3] = 'groups';
cat [4] = 'news';
cat [5] = 'shopping';
//cat [6] = "javascript: alert('Search in Local');";

locked=false;

function show_dd_menu() {
document.getElementById("dd_menu").style.display="block";
hide_dd_menu();
}
function hide_dd_menu() {
setTimeout("hide_dd_menu_imed()", "3000");
}
function hide_dd_menu_imed() {
if (locked==false){
document.getElementById("dd_menu").style.display="none";
}
}

function change_menu(id) {
document.getElementById("dd_menu").innerHTML="";
for (i=1; i < label.length; i++) {
if (i==id){
document.getElementById("search_label").innerHTML=label[i];
document.getElementById("qcat").value=cat[i];
//document.getElementById("form1").action=action[i];
//alert(action[i]);
}
else {
document.getElementById("dd_menu").innerHTML+="<a href=\"#\" onclick=\"locked=false; change_menu('"+i+"');\">"+label[i]+"</a>";
}
hide_dd_menu_imed();
document.getElementById("qkw").focus();
}
}

function create_dd(){
document.write("<div id=\"dd\" onmouseover=\"locked=true;\" onmouseout=\"locked=false; hide_dd_menu();\"><a href=\"#\" id=\"search_label\" class=\"search_label\" onmousedown=\"this.className='search_label2'; document.getElementById('dd_right').className='dd_right2';\" onmouseup=\"this.className='search_label'; document.getElementById('dd_right').className='dd_right';\" onclick=\"check_form('qkw','form1');\"></a><a href=\"#\" id=\"dd_right\" class=\"dd_right\" onmousedown=\"this.className='dd_right2';\" onmouseup=\"this.className='dd_right';\" onclick=\"show_dd_menu();\"></a><div id=\"dd_menu\"></div></div>");
change_menu(1);
}
///////////////////////////////////////////////////////////



/////////////////drop down button 2/////////////////
label2 = new Array()
apppath = '';

label2 [1] = "Search Funutilities";
label2 [2] = "Search Screensavers";
label2 [3] = "Search Wallpapers";
label2 [4] = "Search Skins";
label2 [5] = "Search Cursors";
label2 [6] = "Search Games";
label2 [7] = "Search eCards";

action2 = new Array()
action2 [1] = "dispatcher.aspx";
action2 [2] = "dispatcher.aspx";
action2 [3] = "dispatcher.aspx";
action2 [4] = "dispatcher.aspx";
action2 [5] = "dispatcher.aspx";
action2 [6] = "dispatcher.aspx";
action2 [7] = "dispatcher.aspx";

tp2 = new Array()
tp2 [1] = "";
tp2 [2] = "ssavers";
tp2 [3] = "wpapers";
tp2 [4] = "skins";
tp2 [5] = "cursors";
tp2 [6] = "games";
tp2 [7] = "ecards";

locked2=false;

function show_dd_menu2() {
document.getElementById("dd_menu2").style.display="block";
hide_dd_menu2();
}
function hide_dd_menu2() {
setTimeout("hide_dd_menu_imed2()", "3000");
}
function hide_dd_menu_imed2() {
if (locked2==false){
document.getElementById("dd_menu2").style.display="none";
}
}

function change_menu2(id) {
document.getElementById("dd_menu2").innerHTML="";
for (i=1; i < label2.length; i++) {
if (i==id){
document.getElementById("search_label2").innerHTML=label2[i];
document.getElementById("form2").action=apppath + action2[i];
document.getElementById("tp").value=tp2[i];
}
else {
document.getElementById("dd_menu2").innerHTML+="<a href=\"#\" onclick=\"locked2=false; change_menu2('"+i+"');\">"+label2[i]+"</a>";
}
hide_dd_menu_imed2();
document.getElementById("q").focus();
}
}

var DownloadDir;
var SSaverSAPSetup = 'dnl/config/250/CrawlerScreensaver.exe';
var TBRSAPSetup = 'dnl/config/250/CrawlerSetup.exe';
//var DownloadDir = 'http://brno.crawler.com/disttlb/' OR http://dnl.crawler.com/
var ToolbarURL; 
var SAPSSaverURL; 
var AfterInstallURL;

function init(sAppPath, sDwnPath){
apppath = sAppPath
DownloadDir = sDwnPath
ToolbarURL = DownloadDir + 'install/cr_landing_fun.aspx';
SAPSSaverURL = DownloadDir + 'install/sap_landing_fun.aspx';
if (sDwnPath.indexOf(".inbox.") != -1) {
  ToolbarURL = DownloadDir + 'install/inbox_landing_fun.aspx';
} else {  
  ToolbarURL = DownloadDir + 'install/cr_landing_fun.aspx';
}
}

function create_dd2(){
document.write("<div style=\"z-index:50\" id=\"dd2\" onmouseover=\"locked2=true;\" onmouseout=\"locked2=false; hide_dd_menu2();\"><a href=\"#\" id=\"search_label2\" class=\"search_label2\" onmousedown=\"this.className='search_label2_2'; document.getElementById('dd_right2').className='dd_right2_2';\" onmouseup=\"this.className='search_label2'; document.getElementById('dd_right2').className='dd_right2';\" onclick=\"check_form('q','form2');\"></a><a href=\"#\" id=\"dd_right2\" class=\"dd_right2\" onmousedown=\"this.className='dd_right2_2';\" onmouseup=\"this.className='dd_right2';\" onclick=\"show_dd_menu2();\"></a><div id=\"dd_menu2\"></div></div>");
change_menu2(1);
}
///////////////////////////////////////////////////////////


/////////////////TBR FUNCTIONS/////////////////

var iSS=0;
var sap='NO';
var _tbid='60002';
var tbrver='0.0.0.0';

var isMSIE=((navigator.userAgent.toLowerCase().indexOf("opera")==-1)&&navigator.appName=="Microsoft Internet Explorer")?true:false;
var isFF=(navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);

function InstallIfRequired(cp, tbid, CheckPlugin) {
  try {
    var a=cp;
    //var b=a.substr(3);
    var b=a.substr(0,2);
    if ((typeof(tbr.InstallSkin) == 'undefined') || ((! CheckPlugin) && (tbrver == '0.0.0.0'))) {
		  if (tbid=='') {
		    if (! CheckPlugin) {

		            if (sap=='YES') {
		                //tbr.SetCfgStr('TBR', 'USE_DEFAULT_SKIN', 1, 0);
                    //tbr.SetCfgStr('TBR', 'DEFAULT_SKIN', DownloadDir + 'cr_config.asmx/getSkinForNewToolbarByID?TbId=&TUID=&ID=' + b, 0);
                    if (b=='DS') {tbr.SetCfgStr('', 'INSTALLSKIN', AfterInstallURL, 0);}
                    if (b=='DC') {tbr.SetCfgStr('', 'INSTALLCURSOR', AfterInstallURL, 0);}
                    tbr.InstallPluginEx("APP_INST","Crawler Toolbar",DownloadDir + TBRSAPSetup,"%APPPATH%",1,0);
                    tbr.ApplySettings('PLUGIN_INSTALL');
                  }  else {
                    window.location.href (ToolbarURL + '?cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
                  }
         	      
		    } else {
		      window.location.href (SAPSSaverURL + '?tbid=60252&cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		    }
		  } else {
		    if (tbid!='60001') {_tbid=tbid}
		      if (! CheckPlugin) {
		        
		        if (sap=='YES') {
              //tbr.SetCfgStr('TBR', 'USE_DEFAULT_SKIN', 1, 0);
              //tbr.SetCfgStr('TBR', 'DEFAULT_SKIN', DownloadDir + 'cr_config.asmx/getSkinForNewToolbarByID?TbId=&TUID=&ID=' + b, 0);
              if (b=='DS') {tbr.SetCfgStr('', 'INSTALLSKIN', AfterInstallURL, 0);}
              if (b=='DC') {tbr.SetCfgStr('', 'INSTALLCURSOR', AfterInstallURL, 0);}
              tbr.InstallPluginEx("APP_INST","Crawler Toolbar",DownloadDir + TBRSAPSetup,"%APPPATH%",1,0);
              tbr.ApplySettings('PLUGIN_INSTALL');
            }  else {
              window.location.href (ToolbarURL + '?tbid=' + _tbid + '&cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
            }
		        
		      } else {
		        window.location.href (SAPSSaverURL + '?tbid=60252&cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		      }
		  }
		  return false;
	  }	
	}
	catch (e)
  {
    if (isMSIE) {
      if (confirm('We are sorry, an unexpected error has occurred. Try to open new Internet Explorer window or update your Toolbar.\nDo you want to update your Toolbar now?')) {
        if (tbid=='') {
		      window.location.href (ToolbarURL + '?cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		    } else {
		      if (tbid!='60001') {_tbid=tbid}
		      window.location.href (ToolbarURL + '?tbid=' + _tbid + '&cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		    }
		  }
		}
		else if(isFF){
			if (! CheckPlugin) {			
        window.location.href =ToolbarURL + '?tbid=' + _tbid + '&cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*");
      } else {
        window.location.href =SAPSSaverURL + '?tbid=60252&cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*");
      }
		}
		else{
			alert ("To ensure correct functioning you need to use Internet Explorer version 5.01 or higher.")
		}

    return false;
  }  

	if (CheckPlugin) {
		  try {
		    if ((tbr.GetFileVer('SSAVER') == '0.0.0.0') || (iSS == 3) || (tbr.GetFileVer('SSAVER') == '255.255.255.255')) {
			    var SSinstall = confirm("You need to install the Screensaver plugin to be able to download screensavers.\nDo you wish to install it now?")
				  if (SSinstall == true) {
				    if (document.URL.indexOf('?') !=	-1) {
		          window.location.href (document.URL + '&cinst=' + cp);
		        } else {
		          window.location.href (document.URL + '?cinst=' + cp);
		        }
				  }
				  else {
				    return false
				  }
			    return false
        }
        else
        {
		      if (tbr.GetCfgStr('SSAVER','SSAVER_ALL',1) == '0') {
		        var SSEnable = confirm("You need to enable the Screensaver plugin to be able to download screensavers.\nScreensaver button will appear after you enable it in a new IE window.\nDo you wish to enable it now?")
				    if (SSEnable == true) {
				      tbr.SetCfgBool('SSAVER','SSAVER_ALL',1,1)
			        tbr.ApplySettings('PLUGIN_INSTALL');
			        return true;
				    }
            return false;
          }  
                   
		      //if (iSS == 1) {
		        //not used - old version
			    //  tbr.ActivatePlugin('SSAVER');
 				  //  tbr.ApplySettings('PLUGIN_INSTALL');
          //  alert("Currently open IE window will be closed. Screensaver button will appear after successful download in a new IE window.\nYou can access webgallery through Screensaver button.");
				  //  CloseWindow();
          //  return true
			    //}
		    }
		  }

		  catch (e)
		  {
		    if (!isMSIE) {alert ("To ensure correct functioning you need to use Internet Explorer version 5.01 or higher.")} else {
		      if (confirm('We are sorry, an unexpected error has occurred. Try to open new Internet Explorer window or update your Toolbar.\nDo you want to update your Toolbar now?')) {
            if (tbid=='') {
		          window.location.href (ToolbarURL + '?cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		        } else {
		          if (tbid!='60001') {_tbid=tbid}
		          window.location.href (ToolbarURL + '?tbid=' + _tbid + '&cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		        }
		      }
		    }  
			  return false;
		  };
	};
	return true;
}


function InstallSSPlugin(tbid, cp, ssaiparam, CU, UID) {
  try {
	  if (typeof(tbr.InstallSkin) == 'undefined') {
		  if (tbid=='') {
		    window.location.href (ToolbarURL + '?cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		  } else {
		    if (tbid!='60001') {_tbid=tbid}
		    window.location.href (ToolbarURL + '?tbid=' + _tbid + '&cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		  }
		  return false;
	  }	
	}
	catch (e)
  {
    if (!isMSIE) {alert ("To ensure correct functioning you need to use Internet Explorer version 5.01 or higher.")} else {
      if (confirm('We are sorry, an unexpected error has occurred. Try to open new Internet Explorer window or update your Toolbar.\nDo you want to update your Toolbar now?')) {
        if (tbid=='') {
		      window.location.href (ToolbarURL + '?cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		    } else {
		      if (tbid!='60001') {_tbid=tbid}
		      window.location.href (ToolbarURL + '?tbid=' + _tbid + '&cinst=' + cp + '.CU_' + escape((document.URL).replace(/=/g,"**")).replace(/\./g,"*"));
		    }
		  }
		}  
    return false;
  }  
  tbr.SetCfgStr('', 'SSINPROCESS', 15, 0);
  tbr.SetCfgStr('', 'SSINSTALL_SHOW', CU, 0);
  tbr.SetCfgStr('', 'SSAIPARAM', ssaiparam, 0);
  tbr.SetCfgStr('', 'SSAIMODE', 1, 0);
  if (UID != '') tbr.SetCfgStr('', 'SSAIBG', UID, 0);
  if (sap=='YES') {
    tbr.InstallPluginEx("SSAVER","Crawler Screensaver",DownloadDir + SSaverSAPSetup,"%APPPATH%",1,0);
  }  else {
    tbr.InstallPluginEx("2DSAVER","2D Screensaver",DownloadDir + "dnl/config/1/2Dsaver4.cab","%APPPATH%\\SSaver\\bin\\2Dsaver\\",0,0);
    tbr.InstallPluginEx("SSAVER","Screensaver",DownloadDir + "dnl/config/1/CScreenSaver.cab","%APPPATH%",1,0);
  }
  tbr.ApplySettings('PLUGIN_INSTALL');
  if (sap!='YES') {
    alert("Currently open IE window will be closed. Screensaver button will appear after successful download in a new IE window.\nYou can access webgallery through Screensaver button.");
	  CloseWindow();
	}
}

function LoadSkin(SkinUrl, tbid, cp) {
  AfterInstallURL = SkinUrl;
	if (InstallIfRequired(cp, tbid, false)) {
		tbr.InstallSkin(SkinUrl);
	}
	AfterInstallURL = '';
}

function LoadCursor(CursorUrl, tbid, cp) {
	AfterInstallURL = CursorUrl;
	if (InstallIfRequired(cp, tbid, false)) {
		tbr.InstallCursor(CursorUrl);
	}
	AfterInstallURL = '';
}

function LoadSSaver(SSaver, tbid, cp, uid) {
	if (InstallIfRequired(cp, tbid, true)) {
		tbr.MenuClick('SSAVER','SS_DL',SSaver + '|'+ uid);
	}
}

function LoadBckGround(SSaver, tbid, cp, uid) {
	if (InstallIfRequired(cp, tbid, true)) {
		tbr.MenuClick('SSAVER','SS_DLWALLPAPERINSTALL',SSaver + '|'+ uid);
	}
}

function CloseWindow()
{
	window.opener=window;
	window.close();
}



////// Initalizing Toolbar Object In Page ///////////////////////////

NS4	= (document.layers);
IE4	= (document.all);
isMac =	(navigator.appVersion.indexOf("Mac") !=	-1);
	
isIE = (IE4	&& !isMac);
	
function DrawTbObject(){
	if (typeof(tbr) == 'undefined') {
	  if (isIE) {
			document.write("<" + "OBJECT classid='clsid:8736C681-37A0-40C6-A0F0-4C083409151C' ID=tbr width=0 height=0 style='position:absolute'></OBJECT>");
		}
	}
	else  {
		if (typeof(tbr.InstallCursor) == 'undefined') {
			if (isIE) {
			  document.write("<" + "OBJECT classid='clsid:8736C681-37A0-40C6-A0F0-4C083409151C' ID=tbr width=0 height=0 style='position:absolute'></OBJECT>");
			}
		}
	}
	try {
    iSS=tbr.PluginState('SSAVER');
    sap=tbr.GetText('APP','STANDALONE_PLUGIN',''); 
    tbrver = tbr.GetFileVer('TBR');
  }
  catch (e)
  {
  } 
	return;
}
///////////////////////////////////////////////////////////



////////////////checks rating form/////////////////////////////

function check_rating_form(form_id){

if ((document.getElementById("rating5").checked==false)&&(document.getElementById("rating4").checked==false)&&(document.getElementById("rating3").checked==false)&&(document.getElementById("rating2").checked==false)&&(document.getElementById("rating1").checked==false)){
alert("Please select your rating");
}
else {
document.getElementById(form_id).submit();
}



}

///////////////////////////////////////////////////////////


////////////////flash plugin detecting/////////////////////////////

function checkFlash(version) {
	var isFlash = false;
	var verStr = (version) ? "."+version : "";
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])
		isFlash = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
	else if (navigator.plugins && navigator.plugins['Shockwave Flash'])
		isFlash = true;
	else if (Boolean(document.getElementById))
		eval('try {var o=new ActiveXObject("ShockwaveFlash.ShockwaveFlash'+verStr+'");if(o)isFlash=true;o=null;} catch(e){}');
	return Boolean(isFlash);
}
function FlaOrImg() {
	if (checkFlash(6)) {
		document.writeln("<object type=\"application/x-shockwave-flash\" data=\"" + fla_data + "?fla_url=" + fla_url + "\" width=\"" + fla_width + "\" height=\"" + fla_height + "\">");
		document.writeln("<param name=\"movie\" value=\"" + fla_data + "?fla_url=" + fla_url + "\" />");
		document.writeln("<param name=\"menu\" value=\"false\" />");
		document.writeln("<param name=\"quality\" value=\"high\" />");
		document.writeln("<param name=\"wmode\" value=\"transparent\" />");
		document.writeln("<param name=\"bgcolor\" value=\"#" + fla_bgcolor + "\" />");
		document.writeln("</object>");
	} else {
		document.writeln("<a href=\"" + fla_url + "\"><img class=\"advflash\" src=\"" + alt_img + "\" width=\"" + fla_width + "\" height=\"" + fla_height + "\" alt=\"\" /></a>");
	}
}


function xrating(){
if(document.getElementById("xrating").style.display=="none"){document.getElementById("xrating").style.display="block"}
else{document.getElementById("xrating").style.display="none"};
}

var IE=((navigator.userAgent.toLowerCase().indexOf("opera")==-1)&&navigator.appName=="Microsoft Internet Explorer")?true:false;
function aCN (el, name) {if ((el.className == "") || (el.className == " ")) el.className = name;else el.className += " " + name;}
function CN (el, name) {var i, list;if (el.className) {list = el.className.split(" ");for (i = 0; i < list.length; i++) if (list[i] == name) return true;}return false;};
function rCN (el, name, c) {var i, j, curList, newList;if (el.className == "") return;newList = new Array();curList = el.className.split(" ");j=0;for (i = 0; i < curList.length; i++)if (curList[i] != name)newList[i-j]=curList[i];  else j++;if (c!=1)el.className = newList.join(" ");else return newList.join(" ")};
function gEC(el,class_name,tag_name) {var all_obj,ret_obj=new Array(),j=0;all_obj=el.getElementsByTagName(tag_name);for(i=0;i<all_obj.length;i++) {  if(CN(all_obj[i],class_name)) {   ret_obj[j]=all_obj[i];   j++;}}if (ret_obj.length>0) return ret_obj; else return false;}


function sO(a){if(IE){if(a==0)document.styleSheets[0].addRule("object", "display:none !important", 0);else document.styleSheets[0].removeRule(0);}}

function aFlash(z,n){
	if (checkFlash(6)) {
		var a=gEC(document,"put_flash","span");
		for(var i=0;i<a.length;i++){
			rCN(a[i],"put_flash");
			var b=a[i].getElementsByTagName("img");
			if(b.length>0){
				var aa=b[0].parentNode;
				var aahref="";
				if(aa.tagName.toLowerCase()=="a"){
					aahref="?fla_url="+escape(aa.href.replace(/\&amp;/,"\&"));
				}
				var re=new RegExp(z);
				var data=b[0].src.replace(re,n)+aahref;
				var h=b[0].height;
				var w=b[0].width;
				var o=create_flash(data,w,h);
				a[i].parentNode.insertBefore(o,a[i]);

				var oh="";
				oh+=flash_param(o,"movie",data);
				oh+=flash_param(o,"quality","high");
				oh+=flash_param(o,"menu","false");
				oh+=flash_param(o,"bgcolor","#f2f2f2");
				oh+=flash_param(o,"wmode","transparent");

				if(oh!=""){
					oh+=a[i].outerHTML;
					o.outerHTML=(p=o.outerHTML).slice(0,p.indexOf(">")+1)+oh+"</object>";
					a[i].parentNode.removeChild(a[i]);
				}
				else o.appendChild(a[i]);

			}
		}
	}
}

function create_flash(data,w,h){
	var o=document.createElement("object");
	o.type="application/x-shockwave-flash";
	o.data=data;
	o.height=h;
	o.width=w;
	return o;
}

function flash_param(o,n,v){
	if(IE)return "<param name=\""+n+"\" value=\""+v+"\">";
	else{
		var p=document.createElement("param");
		p.name=n;
		p.value=v;
		o.appendChild(p);
		return"";
	}
}

////////////////eCards Functions////////////////////
var _font='2', _font_size='0', _bold='false', _italic='false', font_color='18', bkg_color='13', bkg_img, layout='1', control, _song=0, song0, switch1=0, switch2=0, song0='';
function make_ecard() {
	document.getElementById('ecard_bkg').style.display='none';
	document.getElementById('ecard_bkg').style.display='block';
	document.getElementById('ecard_bkg').className='ecard_bkg' + layout + ' b' + bkg_color + ' ' + bkg_img;
	document.getElementById('message').className='message c' + font_color + ' f' + _font + ' s' + _font_size + ' bd' + _bold + ' st' + _italic;
	document.getElementById('descr').className='descr c' + font_color + ' f' + _font + ' d' + _font_size;
}

function wmplay_midi(control) {
	i = document.getElementById('wmplayer');
	if(control==1 && _song>0) { i.innerHTML = "<object type='application/x-mplayer2' data='" + eval("song" + _song) + "' width='300' height='300'><param name='filename' value='" + eval("song" + _song) + "'><param name='autostart' value='1'><param name='showcontrols' value='1'><param name='showstatusbar' value='1'><param name='SendPlayStateChangeEvents' value='1'><param name='SendOpenStateChangeEvents' value='1'></object>" } else { i.innerHTML = "<div></div>" }
    
}
function layout_checked(is_checked){
	for(i = 1; i < 4; i++) {
		document.getElementById('layout'+i).checked='false';
	}
	document.getElementById('layout'+is_checked).checked='true';
}


function Flash(){this.movie="";this.img="";this.width="";this.height="";this.alt="";this.bgcolor="transparent";this.ver=7;this.link="";this.tracker="";this.ie=((navigator.userAgent.toLowerCase().indexOf("opera")==-1)&&navigator.appName=="Microsoft Internet Explorer")?true:false;this.className="";this.id="";this.urlparam="url";this.target="_blank";this.install=false;this.flashvars=null;this.params={}}
Flash.prototype.iF=function(i){if(!this.ie)return true;try{var a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);return true}catch(e){return false}}
Flash.prototype.write=function(m,w,h,a,b){var o=this.HTML(m,w,h,a,b);document.write(o)}
Flash.prototype.param=function(n,v){return '<param name="'+n+'" value="'+v+'" />';}
Flash.prototype.writeBanner=function(i,w,h,l,t,b){this.preBanner(i,null,w,h,l,t,b);var lnk=(this.link==null||this.link=="")?false:true;this.movie=this.img.slice(0,this.img.lastIndexOf('.'))+".swf"+((lnk)?"?"+this.urlparam+"="+escape(this.link):"");this.write();}
Flash.prototype.writeBannerAlt=function(i,m,w,h,l,t,b){this.preBanner(i,m,w,h,l,t,b);var lnk=(this.link==null||this.link=="")?false:true;if(m!=null&&m!='')this.movie=m+((lnk)?"?"+this.urlparam+"="+escape(this.link):"");this.write();}
Flash.prototype.preBanner=function(i,m,w,h,l,t,b){if(i!=null&&i!="")this.img=i;if(l!=null&&l!="")this.link=l;if(t!=null&&t!="")this.tracker=t;if(w!=null&&w!="")this.width=w;if(h!=null&&h!="")this.height=h;if(b!=null&&b!="")this.bgcolor=b;var lnk=(this.link==null||this.link=="")?false:true;if(lnk&&(this.tracker!=null&&this.tracker!=""))this.link=this.tracker+escape(this.link);var a='<img src="'+this.img+'" width="'+this.width+'" height="'+this.height+'" alt="" border="0" class="'+this.className+'" />';this.alt=((!lnk)?a:'<a href="'+this.link+'" target="'+this.target+'">'+a+'</a>')}
Flash.prototype.HTML=function(m,w,h,a,b){if(m!=null&&m!="")this.movie=m;if(w!=null&&w!="")this.width=w;if(h!=null&&h!="")this.height=h;if(a!=null&&a!="")this.alt=a;if(b!=null&&b!="")this.bgcolor=b;var ci=(this.ie)?' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"':'';var p=(this.ie&&this.install)?' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.ver+',0,0,0"':'';var o;var z=this.iF(this.ver);var z1=this.iF(1);if (this.movie!=null&&this.movie!=""&&(this.install||(z1&&z)||(!z1&&!z)))o='<object type="application/x-shockwave-flash" data="'+this.movie+'" width="'+this.width+'" height="'+this.height+'"'+ci+p+' id="'+this.id+'" class="'+this.className+'" >'+this.param("movie",this.movie)+((this.flashvars!=null)?this.param("flashvars",this.flashvars):"")+this.param("quality","high")+this.param("menu","false")+this.param('AllowScriptAccess','always')+((this.bgcolor=="transparent")?this.param("wmode","transparent"):this.param("bgcolor",this.bgcolor))+this.customParams()+this.alt+'</object>';else o=this.alt;return o}
Flash.prototype.writeTo=function(id,m,w,h,a,b){var el=document.getElementById(id);if(el)el.innerHTML=this.HTML(m,w,h,a,b)}
Flash.prototype.customParams=function(){var o='';for(var k in this.params)o+=this.param(k,this.params[k]);return o;}
Flash.prototype.addParam=function(name,value){this.params[name]=value;}


var CTBR_Events={
  IsIE:(navigator.userAgent.toLowerCase().indexOf("windows")!=-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1&&navigator.appName=="Microsoft Internet Explorer")?true:false,
  IsFF:(navigator.userAgent.toLowerCase().indexOf("windows")!=-1&&navigator.userAgent.toLowerCase().indexOf("firefox")!=-1&&"createEvent" in document)?true:false,
  IsToolbarInstalled:false,
  IsToolbarInstallAble:false,
  /*
  Init, need to be run while page is rendering
  */
  Init:function(){
    if(this.IsIE){
      if (typeof(tbr) == 'undefined') {
        document.write("<" + "OBJECT classid='clsid:8736C681-37A0-40C6-A0F0-4C083409151C' ID=tbr width=0 height=0 style='position:absolute'></OBJECT>")
      }
    }
    this.IsToolbarInstalled=this._IsToolbarInstalled();
    this.IsToolbarInstallAble=(this.IsIE||this.IsFF);
  },
  /*
  main comunication function
    Argument 0:    tbr object method name
    Arguments 1-N: method arguments
  
  */
  Get:function(){
    if(!this.IsToolbarInstalled)return null;
    if(this.IsIE){
      var a=[];
      for(var i=1;i<arguments.length;i++){a.push("'"+arguments[i]+"'")};
      try{
         return eval("tbr."+arguments[0]+"("+a.join(",")+")");
      }
      catch(e){return null}
    }
    else if(this.IsFF){
      var el=document.createElement("CTBR_Get");
      for(var i=0;i<arguments.length;i++)
        el.setAttribute("Attribute"+i,arguments[i]);
      document.documentElement.appendChild(el);
      var evt = document.createEvent("Events");
      evt.initEvent("CTBR_Get", true, false);
      el.dispatchEvent(evt);
      return el.getAttribute("return");
    }
    else return null;
  },
  /*
  check if plugin is installed
  */
  IsPluginInstalled:function(plugin){
    return (CTBR_Events.IsToolbarInstalled && this.Get("PluginState",plugin)==0);
  },
  /*
  internal function
  */
  _IsToolbarInstalled: function(){
    this.IsToolbarInstalled=true;
    if(this.IsIE){
      this.IsToolbarInstalled=(typeof(tbr.GetDllVer)!=='undefined'&&tbr.GetFileVer("APP") != '0.0.0.0');
    }
    else if(this.IsFF){
      this.IsToolbarInstalled=(!(this.Get('GetFileVer','APP')==null));
    }
    else this.IsToolbarInstalled=false;
    return this.IsToolbarInstalled;
  }
};
CTBR_Events.Init();



function ResizableAd(url){
  //var open=(!CTBR_Events.IsToolbarInstallAble || CTBR_Events.IsToolbarInstalled);

  var open=(CTBR_Events.IsToolbarInstalled);
  
  if(open){
    var add=new Flash();
    add.width=728;
    add.height= 400;
    add.movie=url+((open) ? '':'?opennow=false');    
    add.id='flashidflash';
    add.addParam('scale','noscale');
    add.addParam('salign','tl');
    document.write('<div id="flashadd"><div id="flashid" style="height:'+((open)?400:90)+'px">');
    add.write();
    document.write('</div></div>');
  }
}

function sendToFlash(key,val){
	document.getElementById('flashidflash').SetVariable(key,val);
}

function setFlashHeight(id,height){
  document.getElementById(id).style.height = height+"px";		
}
