
var ajax = new Array();

function getCityList(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('models').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = '/models.php?brandid='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}


function getCityList2(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('models').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = '/models2.php?brandid='+countryCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}



function obview(id)
{
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = '/bancount/obview.php?id='+id;	// Specifying which file to get
		ajax[index].onCompletion = function(){ updateobview(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	//}
}


function updateobview(index)
{
	document.getElementById('obview').innerHTML = ajax[index].response;

}



function createCities(index)
{
	var obj = document.getElementById('models');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code
}

function hide1(elemId){
document.getElementById(elemId).style.display = 'none';
}

function toggle(elemId) {
//document.getElementById(elemId).style.display = 'block';
if (document.getElementById(elemId).style.display == 'none') {
document.getElementById(elemId).style.display='block';
}
else { document.getElementById(elemId).style.display = 'none';
}
}

function hidebrand(){
//document.getElementById('brand_id').style.display = 'none';
document.getElementById('models').style.display = 'none';
}

var newwindow; //popup send link
function poptastic(url)
{
	newwindow=window.open(url,'name','height=650,width=750');
	if (window.focus) {newwindow.focus()}
return false;
}

function poptastic2(url)
{
	newwindow=window.open(url,'name','height=650,width=750');
	if (window.focus) {newwindow.focus()}
return false;
}

function poptastic3(url)
{
	newwindow=window.open(url,'name','height=200,width=300');
	if (window.focus) {newwindow.focus()}
return false;
}

function poptastic4(url)
{
	newwindow=window.open(url,'name','height=370,width=450');
	if (window.focus) {newwindow.focus()}
return false;
}


// Example:
// simplePreload( '01.gif', '02.gif' );
function simplePreload()
{   var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)  {
   document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

function switchImage(imgName, imgSrc) {
  if (document.images)  {
    if (imgSrc != "none")    {
     document.images[imgName].src = imgSrc;
    }
  }
}



function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}




