if(document.getElementById) document.write('<style type="text/css">TR.subdiv{display:none } TR.subdiv_expand{display:none }</style>');
var is = new Is();
function Is(){
  this.agent=navigator.userAgent.toLowerCase();
  this.firefox = (this.agent.indexOf('firefox')!=-1) ? true:false;
  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,url){
  var img = document.getElementById(id);
  if(!img){
	  img = document.images[id];
  }
  if (img){
	  if (typeof(url)=="undefined"){
		  if(mode==1) img.src=img.src.substr(0,img.src.length-4)+'_o.'+img.src.substr(img.src.length-3,img.src.length);
		  if(mode==0) img.src=img.src.substr(0,img.src.length-6)+'.'+img.src.substr(img.src.length-3,img.src.length);  
	  }else{
	  	  img.src=url;
	  }
  }
}

var divover="#FFC600";
var divcolor=["#AFB0B3","#FFD16F","#FFE0A8"];

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 hilitesubdiv(myobj,mode){
/*  kids = myobj.childNodes;
  if(mode==0){
    color1=subdivcolor1;
    color2=subdivcolor2;
  }
  if(mode==1){
    color1=subdivcolor3;
    color2=subdivcolor4;
    try{ myobj.style.cursor="pointer"; } catch (a){}
    try{ myobj.style.cursor="hand"; } catch (a){}
  }
  if(mode==3){
    color1=subdivcolor5;
    color2=subdivcolor6;
  }
  for(var i=0; i<kids.length; i++){
    if(kids[i].nodeName=='TD'){
      kids[i].style.backgroundColor=color1;
    }
  }*/
}

function opendiv(id,all){
	var display='none';
	if (typeof(document.getElementById)!="undefined"){
		var temp_obj=document.getElementById("subdiv"+id);
		if(temp_obj.innerHTML!='<TD></TD>' && (temp_obj.style.display=='none' || temp_obj.style.display=='')) 
			display=(is.ie4)?'block':'table-row';
		temp_obj.style.display=display;
	}
	if (typeof(all)!="undefined" && all==1){
		var kids=document.getElementById("subdiv"+id).firstChild.childNodes;
		for (var i in kids){
			if(typeof(kids[i].nodeName)!="undefined" && kids[i].nodeName=="TABLE"){
				var _rows=kids[i].rows;
				for (var j in _rows){
					if (typeof(_rows[j].id)!="undefined" && _rows[j].id && typeof(document.getElementById("subdiv"+_rows[j].id)!="undefined")){
						opendiv(_rows[j].id.substr(6),all);
					}
				}
			}
		}
	}

}

function OpenImg(src, width, height, target, scrollbars,title,prev_img,next_img)
{
 
 var add_height=0;
 if (typeof(next_img)!="undefined" && next_img!="" || typeof(prev_img)!="undefined" && prev_img!=""){
 	add_height+=30;
 }
 if (title!=undefined && title!=""){
 	add_height+=30;
 }else
 	title="";
 win=window.open('',target,'screenX='+Math.floor((screen.availWidth-width)/2)+', screenY='+Math.floor((screen.availHeight-height-add_height)/2)+', left='+Math.floor((screen.availWidth-width)/2)+', top='+Math.floor((screen.availHeight-height-add_height)/2)+', width='+(Math.min(width,screen.availWidth-30))+',height='+Math.min(height+add_height,screen.availHeight-30)+',hotkeys=1,resizable=yes,scrollbars=auto');
 
 win.document.write('<html><head>'+(title?'<title>'+title+'</title>':'')+'<style type="text/css">body{padding:0px;margin:0px;} td{height:30px; text-align:center}</style></head><body marginwidth=0 marginheight=0>');
 WriteImg(win,src,width,height,prev_img,next_img,title);
 win.document.write("</body></html>");
 //win_height=((is.ie4)? document.body.clientHeight: window.innerHeight);
 //alert(win_height);
 //if (height>win_height)
 win.focus();
 win.document.close();
 
}

function WriteImg(win,src,width,height,prev_img,next_img,title){
 if (win=='')
 	win=window;
 format=src.substr(src.length-3,src.length);
 win.document.write('<table cellpadding="0" cellspacing="0" border="0"><tr><td>');
 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('</td></tr>');
 if (typeof title!="undefined" && title!=''){
 	win.document.write('<tr><td id="title">'+title+'</td></tr>');
 }
 if (typeof(next_img)!="undefined" && next_img!="" || typeof(prev_img)!="undefined" && prev_img!=""){
 	win.document.write('<tr><td id="nav">');
 	if (typeof(prev_img)!="undefined" && prev_img!=""){
 		win.document.write('<a href="'+prev_img+'"><img hspace="10" src="'+relative_path+'pics/photo-arrow-left.png" border="0" alt=""></a>');
 	}else{
 		win.document.write('<img hspace="10" src="'+relative_path+'pics/photo-arrow-left.png" border="0" alt="">');
 	}
 	if (typeof(next_img)!="undefined" && next_img!=""){
 		win.document.write('<a href="'+next_img+'"><img hspace="10" src="'+relative_path+'pics/photo-arrow-right.png" border="0" alt=""></a>');
 	}else{
 		win.document.write('<img hspace="10" src="'+relative_path+'pics/photo-arrow-right.png" border="0" alt="">');
 	}
 	win.document.write('</td></tr>');
 }
 win.document.write('</table>');
 /*if (is.ie4){
 	width+=33;
 	height+=40;
 }*/
	win.moveTo(Math.floor((screen.availWidth-width)/2),Math.floor((screen.availHeight-height)/2));
 
}

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=auto');
	win.focus();
	return false;
}
function setClientSize(w, h)
{
window.resizeBy(w-document.body.clientWidth, h-document.body.clientHeight);
}

function adjust_width(start_width){
	var id=document.getElementById("middle");
	//var offset=(id.scrollWidth-id.offsetWidth);
	var offset=id.scrollWidth-start_width;
	if (offset>0){
		if (is.ie4){
			//document.getElementById("footer").style.width=(document.getElementById("footer").offsetWidth+offset-182)+"px";
			//id.style.width=(id.offsetWidth+offset)+"px";
			document.getElementById("footer").style.width=(document.getElementById("footer").offsetWidth+offset-1)+"px";
			id.style.width=(id.offsetWidth+offset)+"px";
			if (start_width!=578)
				document.getElementById("outer").style.width=(document.getElementById("outer").offsetWidth+offset-93)+"px";
		}else{
			id.style.width=(id.offsetWidth+offset-60+(is.opera?30:0))+"px";
			document.getElementById("outer").style.width=(document.getElementById("outer").offsetWidth+offset+(is.opera?30:0))+"px";
		}
		//alert(document.getElementById("middle").style.width);
		//alert(document.getElementById("middle-top").style.width);
		//document.getElementById("header").style.width=(document.getElementById("header").offsetWidth+offset)+"px";
	}
}

