/*start zebra tables*/
  // this function is need to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) { 
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function stripe(id) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them; 
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  
    // obtain a reference to the desired table 
    // if no such table exists, abort
    var table = document.getElementById(id);
    if (! table) { return; }
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child 
    // &lt;tbody&gt;s 
    var tbodies = table.getElementsByTagName("tbody");

    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
    
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr"); 
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {

     // avoid rows that have a class attribute
        // or backgroundColor style
     if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) {
 
         // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
        
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j]; 

            // avoid cells that have a class attribute
            // or backgroundColor style
         if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
        
        mytd.style.backgroundColor = even ? evenColor : oddColor;
              
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }
/*end zebra tables*/


/*Mail Parbaude*/

function MailParbaude(msg_Correct, form_name, inp_name){
if (validateFormEmail(msg_Correct, inp_name))
	{
	form_name.submit();
	}
}

function validateFormEmail(msgCorrectEmail, email){
   //validate email
   if (!isValidEmail(email.value))
   	{
	alert(msgCorrectEmail);
	email.value="";
	return false;
   	}
   else
   	{
	return true;
	}
}

function isValidEmail(email){
 var emailRegExp = "[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]{2,4}$";
 var regex = new RegExp(emailRegExp);
 return regex.test(email);
}


var restoreimgsrc="";

function MMon(p){
restoreimgsrc = document.images[p].src;
document.images[p].src=restoreimgsrc.substring(0,restoreimgsrc.length-4)+"_on.gif";
}
function MMof(p){
 document.images[p].src=restoreimgsrc;
}

function Pagelocation(page) {
 if (page.indexOf("/")>=0 ) document.location = page;
}

function imgchange(chimg){
  var imgobj = document.images[chimg];
  imgpath = imgobj.src;
  imgpath_base = imgpath.substring(0,imgpath.length-6);

  switch (imgobj.width){
     case 231:   // normal=>lager
       imgobj.width  = 456;
       imgobj.height = 306;
       imgobj.src=imgpath_base + '_1.jpg';
       break;
     case 456:
       imgobj.width  = 231;
       imgobj.height = 156;
       imgobj.src=imgpath_base + '_2.jpg';
       break;
     case 156:  //vertcal=>v.large
       imgobj.width  = 306;
       imgobj.height = 456;
       imgobj.src=imgpath_base + '_1.jpg';
       break;
     case 306:  //vertcal=>v.large
       imgobj.width  = 156;
       imgobj.height = 231;
       imgobj.src=imgpath_base + '_2.jpg';
       break;
  }

}

function galeryimgshow(chimg){
  var imgobj = document.images[chimg];
  imgpath = imgobj.src;
  imgpath_base = imgpath.substring(0,imgpath.length-5);
  //imgwidth  = imgobj.width;
  bgimg.src=imgpath_base + '1.jpg';
}

function showNavLayer(){
document.getElementById("NavLayer").style.visibility="visible";
}

function hideNavLayer(){
document.getElementById("NavLayer").style.visibility="hidden";
}


function ShowMe(el) {
  document.all[el].style.visibility = "visible";
}
function HideMe(el) {
  document.all[el].style.visibility = "hidden";
}


function popup( src) {
 wdparms = 'width=330,height=330,scrollbars=no,resizable=yes,toolbar=no,menubar=no,left=20,top=20';
 window.open( 'popup.php?src='+src,'',  wdparms );
}

var new_window;
function RecordPopup(src,width,height) {
 wdparms = 'width='+ width +',height='+ height +',scrollbars=no,resizable=yes,toolbar=no,menubar=no,left=50,top=50';
 new_window = window.open( src,'',  wdparms );
 intervalID = setInterval("reloadAfterUpload()",250);
}

function reloadAfterUpload(){
	if (new_window.closed){
		location.reload();
		clearInterval(intervalID);
		}
}

function full(src) {
 wdparms = 'status=no,titlebar=no,location=no,scrollbars=auto,toolbar=no,menubar=no,fullscreen=1';
 window.open( src,'',  wdparms );
}


var restorebck="";

function changeBckOver(p){
restorebck = document.getElementById(p).style.backgroundImage;
//alert(restorebck);
if (restorebck.indexOf('_on')==-1){
document.getElementById(p).style.backgroundImage = restorebck.substring(0,restorebck.length-5)+"_on.gif)";
}
//alert(restorebck.substring(0,restorebck.length-5)+"_on.gif)");
//document.images[p].src=restorebck.substring(0,restorebck.length-4)+"_on.gif";
}
function changeBckOut(p){
if (restorebck.indexOf('_on')==-1){
document.getElementById(p).style.backgroundImage = restorebck;
}
// document.images[p].src=restorebck;
}


function mC(a){
//alert(a.tagName);
//alert();
z=a.getElementsByTagName("a");
myBody=z.item(0);
//alert(myBody.href);
//z=myBody.getElementsByTagName('a')
//window.open(myBody.href);
location.href=myBody.href;
//myBody.click();
}



function popupImage(src) {
	 wdparms = 'width=200,height=200,scrollbars=no,resizable=yes,toolbar=no,menubar=no,left=50,top=100';
	 window.open( 'popupImage.php?src='+src, 'popup',  wdparms );
}

function popupWindow(src,width,height,scrollbars,toolbar,resizable, menubar,title,autosize) {
	 	wdparms = 'width='+width+',height='+height+',scrollbars='+scrollbars+',toolbar='+toolbar+',resizable='+resizable+',menubar='+menubar;
		window.open( 'popupWindow.php?src='+src+'&autosize='+autosize+'&title='+title, '',  wdparms );
}

var oldColor;
function changeBckColorOver(p){
oldColor = document.getElementById(p).style.backgroundColor;
if (oldColor!='#DC9147')
document.getElementById(p).style.backgroundColor = '#DC9147';
}

function changeBckColorOut(p){
if (oldColor!=document.getElementById(p).style.backgroundColor)
document.getElementById(p).style.backgroundColor = oldColor;
}

function popupHref(href){
	window.open(href,"",'width=100,height=100');
}

function changeClass(object, name){
	object.className=name;
}

function throwPopup(src,width,height,scrollbars,toolbar,resizable, menubar) {
	 	wdparms = 'width='+width+',height='+height+',scrollbars='+scrollbars+',toolbar='+toolbar+',resizable='+resizable+',menubar='+menubar;
		return window.open(src, '',  wdparms );
}

