function UpdateIssues() {
	var i=0;
	var j=0;
	
	var idx=document.query.p.selectedIndex;
	var iss=document.query.i;
	
	if (idx != 0) {
		iss.disabled=false;
	} else {
		iss.disabled=true;
		return false;
	}
	
	for (i=0; i< iss.options.length; i++) {
		iss.options[i]=null;
	}
	var si=0;
	if (products[idx][2].length>0) {
	 iss.disabled=false;
	 for (i=0; i<products[idx][2].length; i++) {
		for (j=0;j<issues.length; j++) {
			// here we find the correspondence.
			if (issues[j][0] == products[idx][2][i]) {
				iss.options[i]=new Option(issues[j][1],issues[j][0],issues[j][2]);
				/* IE workaround */ if (issues[j][2]) si = issues[j][0];
			}
		}
	}
	if ( navigator.appName == 'Microsoft Internet Explorer' ) {
	    for (j=0; j<iss.options.length; j++) {
		if (iss.options[j].value == si) {
		    iss.selectedIndex=j;
		    break;
		}
	    }
	}
	
	} else {
	    iss.disabled=true;
	}
	return true;
}

function FillProducts() 
{
	var sind;
	for(var i=0; i<products.length; i++) {
		document.query.p.options[i]=
			new Option(products[i][1],products[i][0],products[i][3]);
		if(products[i][3])
		    sind=i;
	}
	if (document.query.p.selectedIndex != 0) {
	    document.query.i.disabled=false;
	}
	if ( navigator.appName == 'Microsoft Internet Explorer') {
	    document.query.p.selectedIndex=sind;
	}
	// This function goes in pair with the previous one.
	UpdateIssues();
}

function checkProduct() {
	if(document.query.p.selectedIndex == '0') {
		alert('Please select product');
		return false;
	} else {
		return true;
	}
}
