function D(p_id) {
    return document.getElementById(p_id);
}

function isEmail(p_str, p_required) {
    if(p_required) {
        if(!isStringFilledIn(p_str)) {
            return -2;
        }
    }
    
	if(!p_str.match(/^[\w]{1,3}[\w\.\-_]*@[\w]{1,3}[\w\-_\.]*\.[\w]{2,6}$/i)) {
		return -1;
	} else {
		return 0;
	}
	
}

function isInteger(p_str, p_required) {
    if(p_required) {
        if(!isStringFilledIn(p_str)) {
            return -2;
        }
    }
    var v_tmp = parseInt(p_str, 10);
    if (v_tmp == p_str) {
        return 0;
    }
    return -1;
}

function isString(p_str, p_required) {
    if(p_required) {
        if(!isStringFilledIn(p_str)) {
            return -2;
        }
    }
    return 0;
}

function isStringFilledIn(p_str) {
    if(p_str.trim().length > 0) {
        return true;
    }
    return false;
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}


function hover(p_id) {
  var v_obj = document.getElementById('_ProductItem_' + p_id);
  v_obj.className = 'ProductLinkHover';
}
function unhover(p_id) {
  var v_obj = document.getElementById('_ProductItem_' + p_id);
  v_obj.className = 'ProductLink';
}

function displayFlash(p_title, p_path, p_previewPicPath, p_width, p_height, p_popupMode) {
    var s1 = new SWFObject("/layouts/pbi/mediaplayer.swf", "mediaplayer", p_width, p_height, "8");
    s1.addParam("allowfullscreen","true");
    s1.addVariable("width", p_width);
    s1.addVariable("height", p_height);
    s1.addVariable("file", p_path);
    s1.addVariable('type', 'flv');
    s1.addVariable('autostart', 'false');
    
    s1.addVariable('enablejs','true');
    s1.addVariable('image', p_previewPicPath);
    $('FlashHolder').style.display = 'inline';
    s1.write("FlashContainer");
    $('FlashTitle').innerHTML = "&#160;&#160;" + p_title;
}

    

