if(document.getElementById) document.write('<style type="text/css">TR.subdiv{display:none }</style>');
var is = new Is();
function Is(){
  this.agent=navigator.userAgent.toLowerCase();
  this.opera = (this.agent.indexOf('opera')!=-1) ? true:false;
  this.ie4 = ((this.agent.indexOf('msie')!=-1) && (this.agent.indexOf('opera')==-1)) ? true:false;
  this.ns6 = ((this.agent.indexOf('gecko')!=-1) && (this.agent.indexOf('opera')==-1)) ? true:false;
  this.ns4 = ((this.agent.indexOf('mozilla')!=-1) && (this.agent.indexOf('opera')==-1) && (this.agent.indexOf('msie')==-1) && (this.agent.indexOf('gecko')==-1)) ? true:false;
}

function SwapImage(id,mode){
  var img = document.images[id].src;
  if(mode==1) document.images[id].src=img.substr(0,img.length-4)+'_o.'+img.substr(img.length-3,img.length);
  if(mode==0) document.images[id].src=img.substr(0,img.length-6)+'.'+img.substr(img.length-3,img.length);  
}

divover="#FFC600";
color=["#AFB0B3","#FFD16F","#FFE0A8"];
subdivcolor1="#d6dbe7"; // Subdiv non active color
subdivcolor3="#d6dbe7"; // Subdiv active color

function hilitediv(myobj,mode,level){
  if(mode==0){
    name="";
  }
  if(mode==1){
    name="template-menu"+(level+1)+"-o";
    try{ myobj.style.cursor="pointer"; } catch (a){}
    try{ myobj.style.cursor="hand"; } catch (a){}
  }
  if(mode==3){
    name="";
  }
  myobj.className=name;
}

function opendiv(id){
	var display='none';
	with(document.getElementById("subdiv"+id)){
		if(innerHTML!='<TD></TD>' && (style.display=='none' || style.display=='')) 
			display=(is.ie4)?'block':'table-row';
		style.display=display;
	}
}

function OpenImg(src, width, height, target, scrollbars,title)
{
 format=src.substr(src.length-3,src.length);
 if (title!=undefined)
 	title="<title>"+title+"</title>";
 else
 	title="";
 win=window.open('',target,'screenX='+Math.floor((screen.availWidth-width)/2)+', screenY='+Math.floor((screen.availHeight-height)/2)+', left='+Math.floor((screen.availWidth-width)/2)+', top='+Math.floor((screen.availHeight-height)/2)+', width='+(width)+',height='+(height)+',hotkeys=1,resizable=yes,scrollbars='+scrollbars);
 win.document.write('<html><head>'+title+'</head><body marginwidth=0 marginheight=0 style="margin:0 0 0 0; padding:0 0 0 0;">');
 if(format!="swf") win.document.write('<IMG src="'+src+'" alt="" width="'+width+'" height="'+height+'">');
 else win.document.write('<OBJECT  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" HEIGHT="'+height+'" WIDTH="'+width+'"><PARAM NAME=movie VALUE="'+src+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE="#FFFFFF"><EMBED  src="'+src+'" quality=high  HEIGHT="'+height+'" WIDTH="'+width+'"    TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
 win.document.write("</body></html>");
 win_height=((is.ie4)? document.body.clientHeight: window.innerHeight);
 if (height>win_height)
 	win.resizeTo(width,win_height);
 win.focus();
 win.document.close();
}

function validate_email(email)
{
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }
      return true;
    }
	return false;
}

function open_popup(src, width, height, target, scrollbars){
	var win=window.open(src,target,'screenX='+Math.floor((screen.availWidth-width)/2)+', screenY='+Math.floor((screen.availHeight-height)/2)+', left='+Math.floor((screen.availWidth-width)/2)+', top='+Math.floor((screen.availHeight-height)/2)+', height='+height+',width='+width+', resizable=no, scrollbars=yes');
	win.focus();
	return false;
}
