if (!_COMMON_JS) {
var _COMMON_JS = 1;

/*
window.dmgonload = new Array();
window.onload = function() {
	for (var i = 0; i < window.dmgonload.length; i++) {
		window.dmgonload[i]();
	}
}
*/


//-----------------------------------------------
function nextElementNode(obj) {
//-----------------------------------------------
	do obj = obj.nextSibling;
	while (obj && obj.nodeType != 1);
	return obj;
}


//-----------------------------------------------
function previousElementNode(obj) {
//-----------------------------------------------
	do obj = obj.previousSibling;
	while (obj && obj.nodeType != 1);
	return obj;
}


//-----------------------------------------------
function getElementById(id){
//-----------------------------------------------
    if (document.getElementById) {
        return document.getElementById(id);
    } else if (document.all) {
        return document.all[id];
    } else if (document.layers) {
        return document.layers[id];
    } else {
        return null;
    }
}


//-----------------------------------------------
function popup(url, name, width, height, resi, topp) {
//-----------------------------------------------
	if (topp)
	{
		var top = 0;
		var left = 0;
		var width = screen.width;
		var height = screen.height;
	}
	else
	{
		var left = (screen.width - width) / 2;
		var top = (screen.height - height) / 2
	}
    return window.open(url,name,'width=' + width + ',height=' + height + ",resizable=" + resi + ",scrollbars=1,menubar=0,left=" + left + ",top=" + top);
}

//-----------------------------------------------
function popup2(url, name, width, height) {
//-----------------------------------------------
	//window.open('offerQuery.php', null, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=640,height=480');"/>
	
	
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	
    return window.open(url,name,'width=' + width + ',height=' + height + ",resizable=0,scrollbars=0,menubar=0,left=" + left + ",top=" + top);
}



//-----------------------------------------------
function getWindowSize() {
//-----------------------------------------------
		/*
		if (self.innerWidth)
		{
			frameWidth = self.innerWidth;
			frameHeight = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientWidth)
		{
			frameWidth = document.documentElement.clientWidth;
			frameHeight = document.documentElement.clientHeight;
		}
		else if (document.body)
		{
			frameWidth = document.body.clientWidth;
			frameHeight = document.body.clientHeight;
		}
		
		alert(frameHeight );*/

  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  this.width = myWidth;
  this.height = myHeight;
}

/*
* Example invocation: addEvent(window, 'load', function() {});
*/
function addEvent(obj, evType, fn){ 
//-----------------------------------------------
	if (obj.addEventListener) { 
		obj.addEventListener(evType, fn, false); // W3C bubbling invocation (like IE)
		return true; 
	} else if (obj.attachEvent){ 
		return obj.attachEvent("on"+evType, fn); // IE invocation (bubbling)
	} else { 
		return false; 
	} 
}


/*
* Example invocation: removeEvent(window, 'load', function() {});
*/
function removeEvent(obj, evType, fn){ 
//-----------------------------------------------
	if (obj.removeEventListener) { 
		obj.removeEventListener(evType, fn, false); // W3C bubbling invocation (like IE)
		return true; 
	} else if (obj.detachEvent){ 
		return obj.detachEvent("on"+evType, fn); // IE invocation (bubbling)
	} else { 
		return false; 
	} 
}


function getViewportHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight; 
	return window.undefined; 
}
function getViewportWidth() {
	if (window.innerWidth!=window.undefined) return window.innerWidth; 
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
	if (document.body) return document.body.clientWidth; 
	return window.undefined; 
}


/*
	Cookie Monsta
*/

function createCookie(name,value,days)
{
	var expires;
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}

function getDigits(value) {
	var digits = new Array();
	
	for (var i = 0, n = value.length; i < n; i++) {
		if (parseInt(value.charAt(i)) == value.charAt(i)) digits[digits.length] = value.charAt(i);
	}
	
	return digits.join('');
}

function toogleOfferQueryCheckBoxes(obj) {
	var checkBoxes = document.getElementsByName('offersIds[]');
	
	for (var n = checkBoxes.length-1; n>=0; n--) {
		checkBoxes[n].checked = obj.checked;
	}
}

function toogleCompanyQueryCheckBoxes(obj) {
	var checkBoxes = document.getElementsByName('companiesIds[]');
	
	for (var n = checkBoxes.length-1; n>=0; n--) {
		checkBoxes[n].checked = obj.checked;
	}
}

}


