var _POPUP_FEATURES = 'location=1, statusbar=1, menubar=1, toolbar=1, scrollbars=1, resizable=1, width=1024, height=768';
var _LOGIN = 'location=0, statusbar=0, menubar=0, toolbar=0, scrollbars=1, resizable=1, width=888, height=600';

var strSearchBox = 'Enter Your Search';

function checkClear(what) {
	if (what.value == strSearchBox) what.value = '';
	what.style.color = '#000000';
}

function checkRestore(what) {
	if (what.value == '') what.value = strSearchBox;
	what.style.color = '#cccccc';
}


function expandCollapse(thisObj, targetObj) {
	var el = document.getElementById(targetObj);
	var ex = thisObj;
	if(el.style.display == "block") {
		el.style.display = "none";
		ex.className = "collapse";
	} else {
		el.style.display = "block";
		ex.className = "expand";
	}
}

function raw_popup(url, target, features) {
    if (isUndefined(features)) features = _POPUP_FEATURES;
    if (isUndefined(target  )) target   = '_blank';
    var theWindow = window.open(url, target, features);
    theWindow.focus();
    return theWindow;
}

function link_popup(src, features) {
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}

function isUndefined(v) {
    var undef;
    return v===undef;
}

function doSubmit(frm) {
	if (tmt_validateForm(frm)) {
		frm.submit();
		return true;
   	}
	return false;
}


function getIndexValue(thisElement) {
	return document.getElementById(thisElement)[document.getElementById(thisElement).selectedIndex].value
}

/* 

	Blankwin function 
	written by Alen Grakalic, provided by Css Globe (cssglobe.com)
	please visit http://cssglobe.com/post/1281/open-external-links-in-new-window-automatically/ for more info
	
*/

this.blankwin = function(){
	var hostname = window.location.hostname;
	hostname = hostname.replace("www.","").toLowerCase();
	var a = document.getElementsByTagName("a");	
	this.check = function(obj){
		var href = obj.href.toLowerCase();
		return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? true : false;				
	};
	this.set = function(obj){
		obj.target = "_blank";
		obj.className = "external";
	};	
	for (var i=0;i<a.length;i++){
		if(check(a[i])) set(a[i]);
	};		
};


this.addEvent = function(obj,type,fn){
	if(obj.attachEvent){
		obj['e'+type+fn] = fn;
		obj[type+fn] = function(){obj['e'+type+fn](window.event );}
		obj.attachEvent('on'+type, obj[type+fn]);
	} else {
		obj.addEventListener(type,fn,false);
	};
};
