function getScrWidth(){
	if (self.screen) { 
		width = screen.width;
	}else if (self.java) { 
		var jkit = java.awt.Toolkit.getDefaultToolkit();
		var scrsize = jkit.getScreenSize(); 
		width = scrsize.width; 
	}else{
		width = 1;
	}
	return width;
}

function getScrHeight(){
	if (self.screen) { 
		height = screen.height;
	}
		else if (self.java) { 
		var jkit = java.awt.Toolkit.getDefaultToolkit();
		var scrsize = jkit.getScreenSize(); 
		height = scrsize.height; 
	}else{
		height = 1;
	}
	return height;
}

function showCity(img, cname, width, height){
	fromLeft=getScrWidth()/2-width/2;
	fromLeft=Math.ceil(fromLeft);
	fromTop=getScrHeight()/2-height/2;
	fromTop=Math.ceil(fromTop);
	window.open('popups/showcity.php?width='+width+'&height='+height+'&img='+img+'&cname='+cname,'bad','height='+height+' ,width='+width+', left='+fromLeft+', top='+fromTop+', resizable=no,toolbar=no,scrollbars=no,location=no,menubar=no,status=no'); 
}

function order(id, orderid, height, width, s){
	fromLeft=getScrWidth()/2-width/2;
	fromLeft=Math.ceil(fromLeft);
	fromTop=getScrHeight()/2-height/2;
	fromTop=Math.ceil(fromTop); 
	window.open('popups/order.php?'+s+'&id='+id+'&orderid='+orderid,'bad','height='+height+' ,width='+width+', left='+fromLeft+', top='+fromTop+', resizable=no,toolbar=no,scrollbars=yes,location=no,menubar=no,status=no'); 
}

function zuzuField(thisForm, pattern, action){
	if(thisForm.value==pattern && action=='clear'){
		thisForm.value='';
	}else if(thisForm.value=='' && action=='set'){
		thisForm.value=pattern;
	}
}

function isEmail(email, msg)
{
var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(email))
		return true;
else{
		alert(msg);
		return false;
	}
}

function setPointer(theRow, theAction, theDefaultColor, thePointerColor)
{
    var theCells = null;
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    }
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
    }
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) {
        if (theAction == 'out') {
            newColor           = theDefaultColor;
        }
    }
    if (newColor) {
        var c = null;
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } 
        }
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } 
    return true;
}

