Automount network drives

Hi,

I’m looking for a solution.
I use my Notebook mobile and due to this I’m often connected to different networks.
Is it anyhow possible to run any script automated after connecting to a network?

Maybe a general script which checks for availability of shares or specific ones depending on the active network connection.
As a perfect solution it would connect on Network A shares B & C, and on disconnecting the network shares should get unmounted.
right now i use shell scripts manually started. but sometimes it is a bit annoying.

An automated way would be much better and more comfortable. Does anybody know who to get it done?
Should work both for wireless and wired connections.

thanks in advance

I found this useful script for a cronjob to automatically check if network is up and then execute a script:
https://wiki.archlinux.org/index.php/NetworkManager#Checking_if_networking_is_up_inside_a_cron_job_or_script

Maybe also the dispatcher scripting might be a thing to look at: http://sysadminsjourney.com/content/2008/12/18/use-networkmanager-launch-scripts-based-network-location/

once more:
thanks leszek. i had a short look at it and if it works as described it will sort out most of my problems. even some new ideas i already got which may make it it even better.