function doSomething(e) {
	if (!e) var e = window.event;

	var tg = (window.event) ? e.srcElement : e.target;
	if (tg.nodeName != 'DIV') return;

	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
	while (reltg != tg && reltg.nodeName != 'BODY')
		reltg= reltg.parentNode

	if (reltg== tg) return;
	// Mouseout took place when mouse actually left layer
	// Handle event
        alert('mouseout');
}


function copyOverValues() {

    document.pay.deliveryFirstName.value = document.pay.billingFirstName.value;
    document.pay.deliverySurname.value = document.pay.billingSurname.value;
    document.pay.deliveryAddress1.value = document.pay.billingAddress1.value;
    document.pay.deliveryAddress2.value = document.pay.billingAddress2.value;
    document.pay.deliveryCity.value = document.pay.billingCity.value;
    document.pay.deliveryPostcode.value = document.pay.billingPostcode.value;
    document.pay.deliveryCountry.value = document.pay.billingCountry.value;

}




//needs jquery to operate

function loginSlide(){
    $("#login").animate({
        height: '57px'
      }, 500 );
}

function loginClose(){
    $("#login").animate({
        height: '0px'
      }, 500 );
}

function submenuSlide(){
    $("#submenu").animate({
        height: '32px'
      }, 1200 );
}

window.onload=function(){
 submenuSlide();
}


function slideDown(ID,list,shrink){

    expand = document.getElementById(list).offsetHeight;

    var listControl = document.getElementById(list);
    var countItems = listControl.getElementsByTagName('li').length;

    //alert(countItems);
    expand = countItems * 25;

    if(document.getElementById(ID).offsetHeight < 60)
    {
      document.getElementById(ID+'-arrow').src = "http://localhost/vickymartin/view/images/arrowdown.jpg";
      document.getElementById(ID+'-arrow').style.marginTop ='5px';
      $("#"+ID).animate({
        height: expand
      }, 1500 );
      

    }else{
        document.getElementById(ID+'-arrow').src = "http://localhost/vickymartin/view/images/arrow.jpg";
        document.getElementById(ID+'-arrow').style.marginTop ='3px';
        $("#"+ID).animate({
        height: shrink
      }, 1500 );
      
    }

}

function showPic(bigpic,smallpic){
    document.getElementById('mainpic-image').src = smallpic;
    document.getElementById('mainpic-link').href = bigpic;
}

function shoppingCartExpand(){
    x = document.getElementById('shopping-bag');
    
    height = document.getElementById('shopping-list').offsetHeight;
    if(height > 0){
        height = height + 80;
    }else{
        height = 30;
    }
    if(x.offsetHeight == 30){
        $("#shopping-bag").animate({
            height: height +'px'
          }, 500 );
    }
}

function shoppingCartShrink(){
    x = document.getElementById('shopping-bag');

    if(x.offsetHeight > 30){
        $("#shopping-bag").animate({
            height: '30px'
          }, 500 );
    }

    return false;
} 
