Hi! (I posted this on the PHP forum, but apparently it's more a javascript problem, so I'm posting this here too)
I made a website for a client 2 years ago, and the guys had the great idea of putting the website on a subdomain. I had a cool cookie system, that allowed the user to choose between four different styles. Now I have a problem with my cookie system. The cookie is created on :
blog.domain.com
and apparently it's read on domain.com, so it's not found. I searched everywhere, but I don't know how to specify that it has to look inside blog.domain.com, or maybe it would be easier to directly create the cookie at domain.com instead of blog.domain.com ?
That's the cookie called styleName that I'm talking about. It was situated at domain.com and it worked flawlessly, and now its at blog.domain.com and it's considered as empty by my code...
Here is my code :
PHP Code:
<?php
if (!empty($_COOKIE['styleName'])) { ?>
</noscript>

<script type="text/javascript" language="javascript">
var currentStyle = getDataCookie('styleName');
document.write ('<link rel="stylesheet" title="default" type="text/css" href="http://www.millesaisons.fr/millesaisons/wp-content/themes/default-fr/' + currentStyle + '.css" />');

</script>
So, obviously, this is the php calling the cookie. But the cookie creation script is here :

HTML Code:
// JavaScript Document
function getWholeCookie(offset) {
	var endstr = document.cookie.indexOf (';', offset)
	if (endstr ==-1) {
		endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset,endstr));
}

function getCookie(name) {
	var arg = name + '=';
	var argLength = arg.length;
	var cookieLength = document.cookie.length;
	var i = 0;
	while (i < cookieLength) {
		var j = i + argLength;
		if (document.cookie.substring(i,j) == arg) {
			return getWholeCookie(j);
		}
		i = document.cookie.indexOf(' ',i) + 1;
		if (i==0) break;
	}
	return '';
}


function setCookie(name,value,expires,path) {
var today = new Date();
today.setTime( today.getTime() );

if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" );
}


function tossCookie( name, path, domain ) {
if ( getCookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}


function getDataCookie(cookiename) {
	var data = '';
	if (navigator.cookieEnabled) data = getCookie(cookiename);
	if (data == '') data = 'fantasy';
	return data;
}
function getDataCookiedim(cookiename) {
	var data = '';
	if (navigator.cookieEnabled) data = getCookie(cookiename);
	if (data == '') data = 'style';
	return data;
}
function changeStyle(newStyle) {
	if (navigator.cookieEnabled) {
	setCookie('styleName',newStyle,31,'/');
	location.href = self.location;
	}
	else alert ('Vous avez besoin d\'activer javascript pour profiter pleinement du site');
}
function changeStyledim(newStyle) {
	if (navigator.cookieEnabled) {
	setCookie('styleNamedim',newStyle,31,'/');
	location.href = self.location;
	}
	else alert ('Vous avez besoin d\'activer javascript pour profiter pleinement du site');
}

function lien(nom,src) {	
	document.images[nom].src=src;}
I wrote this script more than 2 years ago, and as I'm not a javascript person, I browsed the internet and put pieces together to make this

Now, my problem is that styleName is created at blog.domain.com and I want it at domain.com. How do I do that ?
Thanks a lot !!!