Javascript Cookie Setting and Mobile Site Redirection - TOTALLY NEW TO JAVASCRIPT

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Javascript Cookie Setting and Mobile Site Redirection - TOTALLY NEW TO JAVASCRIPT

Ok, so i know basic HTML, and CSS and i have created my own personal portfolio website and i have hosting and a domain. I created a mobile version, and found a small Javascript code snippet that redirects a client depending on their screen resolution. This is awesome so that people viewing my site can view the mobile version and not the regular version, but i want them to be able to view the full site if they wish, so i know that to do that i need to set a cookie so the browser will know when the client tries to view the regular site again to let them.

well the way i wanted to have it set up is like other mobile sites i have found, where if you visit on a mobile device you get redirected to a mobile version, but you can click a "Full Site" link to view the full site, but to do that you need cookies... i figured the less work that a potential client has to do the better. heres the mobile link so you have an idea, and the full site too

^^ well firstly, i understood everthing before $_SESSION. i have no idea how to program in PHP. so if you could explain how that works that would be awesome. and here is what i have so far that redirects to the mobile site. it does it by determining how big your resolution is. (I know its not fool proof, but its a good start)

i write my own code, but i write it in Dreamweaver that way i can use the live view to try and troubleshoot on the fly. they had a couple cookie javascript snippets i thought might be interesting.... i have no idea whether this is right but would this work sort of?

some people have mobile devices without javascript and may have also cookie disabled. i play an online game and sometimes i have to visit the game when i'm not at home. i use my cell phone for that and it doesn't support javascript. so the code above will do nothing on my cell phone.

from the other hand, $_SESSION is an array where you can store various variables in and this way you can form every link on your page. if you have 2 versions of your site in separate folders (full|root and mobile) on the server you can form your links depending on what is stored in for example $_SESSION['mode'] variable: in case it is not set or empty the user goes to the full site but if it is set to 'mobile' he goes to the mobile/ directory

i'm afraid my english is not good enough to explain it clear but i hope there are many people who can explain this idea to you better than me