function setVisible(obj){
	obj = document.getElementById(obj);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
	obj.style.display = (obj.style.display == 'block') ? 'none' : 'block';
}

function setInvisible(obj){
	obj = document.getElementById(obj);
	obj.style.visibility = (obj.style.visibility == 'hidden') ? 'visible' : 'hidden';
	obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
}

function enlarge(obj,desc) {
	setVisible('dimmer');
	setVisible('dimmerContent');
	document.getElementById('dimmerImage').innerHTML = '<img onClick="closeDimmer();" src="'+obj+'" alt="" />';	
	document.getElementById('dimmerDesc').innerHTML = desc;	
}

function closeDimmer() {
	setVisible('dimmer');
	setVisible('dimmerContent');
}

/*
var cX = 0; 
var cY = 0; 
var rX = 0; 
var rY = 0;

function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY; }
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY; }

if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }

function AssignPosition(d) {
	if(self.pageYOffset) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
	} else if(document.documentElement && document.documentElement.scrollTop) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
	} else if(document.body) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
	}

	if(document.all) {
		cX += rX; 
		cY += rY;
	}

	d.style.left = ((cX+10) - 410) + "px";
	d.style.top = ((cY+20) - 250) + "px";
}

function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}

function ShowContent(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block";
}

function ReverseContentDisplay(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	if(dd.style.display == "none") { 
		dd.style.display = "block"; 
	}	else { 
		dd.style.display = "none"; 
	}
}	 */

function ShowContent(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	dd.style.display = "block";	
}

function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}


function unset(tar) {
	document.getElementById(tar).style.display = 'none';
	document.getElementById(tar).style.visibility = 'hidden';
}

$(document).ready(function() {

    $('input[name=s_key]').each(function() {
        var inputValue = $(this).val();     
        if(inputValue) {
            $(this).focus(function() {
                if($(this).val() == inputValue) $(this).val('');    
            });    
            $(this).blur(function() {
                if($(this).val() == '') $(this).val(inputValue);    
            });
        }
    });

    
    $('#regField .rmreginput_txt').focus(function() {
        $(this).css('border', 'solid 1px #000'); 
        $(this).css('padding', '2px'); 
    });        
    
    $('#regField .rmreginput_txt').blur(function() {
        $(this).css('border', 'solid 1px #d1d1d1'); 
        $(this).css('padding', '2px'); 
    });    

    $("#colorswitch a").live("mouseover",function(){
        $("#colorswitch a").removeClass('active');
        $(this).addClass('active');
        source = $("img", this).attr("src");
        id = $("img", this).attr("id");
        $(".productimage a img#"+id).attr("src",source);
    });
	
	var options = {
	    zoomWidth: 300,
	    zoomHeight: 235,
        xOffset: 10,
        yOffset: 0,
		title: false,
        position: "right",
        preloadText: "Zoom laden" //and MORE OPTIONS
    };
    
    $("#colorswitch a img").live("mouseover",function(){
        source = $(this).attr("src");
        id = $(this).attr("id");
        $(".productimage a img#"+id).attr("src", source);
	});
	
	var options = {
    	zoomWidth: 470,
    	zoomHeight: 240,
        xOffset: 25,
        yOffset: 0,
		title: false,
        position: "right",
        preloadText: "Zoom laden" //and MORE OPTIONS
	};

	$('.raprd_img').jqzoom(options);
});

function rmaddChange(one,two,three,four,five,six) {
	var add = document.cntFrm.addVal.value;
	var txt1 = document.getElementById('switch1').innerHTML;
	var txt2 = document.getElementById('switch2').innerHTML;
	var cLink = document.getElementById('addSwitch');
    document.cntFrm.csadd_ord.value = '-2';	
	if(add && add == 'add1') {
		cLink.innerHTML = '- ' + txt2;
		document.cntFrm.addVal.value = 'add2';
		document.getElementById('add2').style.display = 'block';
		document.getElementById('add1').style.display = 'none';
	} else {
		document.cntFrm.addVal.value = 'add1';
		cLink.innerHTML = '- ' + txt1;
		document.getElementById('add2').style.display = 'none';
		document.getElementById('add1').style.display = 'block';
		if(one)
		    document.cntFrm.sbh_osname.value = one;
		else if(document.getElementById('osFriendly') && document.getElementById('osFriendly').value)
		    document.cntFrm.sbh_osname.value = document.getElementById('osFriendly').value;

		if(two)
		    document.cntFrm.sbh_osadstr.value = two;
		else if(document.getElementById('addrFriendly') && document.getElementById('addrFriendly').value)
		    document.cntFrm.sbh_osadstr.value = document.getElementById('addrFriendly').value;
		 
		document.cntFrm.sbh_osadhnr.value = three;
		document.cntFrm.sbh_osadext.value = four;
		document.cntFrm.sbh_oszip.value = five;
		document.cntFrm.sbh_oscity.value = six;
	}
}				

function rmaddDefault(add) {
	var cLink = document.getElementById('addSwitch');
	var txt1 = document.getElementById('switch1').innerHTML;
	var txt2 = document.getElementById('switch2').innerHTML;
	if(add && add == 'add2') {
		cLink.innerHTML = '- ' + txt2;
		document.getElementById('add1').style.display = 'none';
		document.getElementById('add2').style.display = 'block';
	} else {
		cLink.innerHTML = '- ' + txt1;
		document.getElementById('add2').style.display = 'none';
		document.getElementById('add1').style.display = 'block';
	}
}

function addCurrentOrder() {
    $(document).ready(function() {
        $('#optionnote').show();      
    });
}

function removeCurrentOrder() {
    $(document).ready(function() {
         $('#optionnote').hide();
    });
}

function addPickup() {
    $(document).ready(function() {
        $('#optiontekst').show();      
    });
}

function removePickup() {
    $(document).ready(function() {
         $('#optiontekst').hide();
    });
}

// date validator 
//function DateValidator() {
//    $("#dateform").validate({
//      rules: {
//        ord_memo: {
//          required: true,
//          date: true
//        }
//      }
//    });
//}
//
