/*
 * Author 3Devil
 *
 *
 *
*/
var qtips=[];
var	mailtowindow;
var mailtoform;
/*
Ext.onReady(function(){
	Ext.select("a[class=quicktip]").each(function(el){
		pid=el.dom.id.split('-')
		pid=pid[1];
		el.dom.setAttribute('ext:qtitle',el.dom.title);
		el.dom.setAttribute('ext:qtip',"<img src='/thumbnail.php?type=D&amp;id="+pid+"&amp;tw=135&amp;th=135&amp;bgc=F5F3ED'>" );
		el.dom.setAttribute('ext:qwidth',"145");
		el.dom.setAttribute('title','');
	});
	Ext.select("img[class=quicktip]").each(function(el){
		pid=el.dom.id.split('-')
		pid=pid[1];
		el.dom.setAttribute('ext:qtitle',el.dom.title);
		el.dom.setAttribute('ext:qtip',"<img src='/thumbnail.php?type=D&amp;id="+pid+"&amp;tw=135&amp;th=135&amp;bgc=F5F3ED'>" );
		el.dom.setAttribute('ext:qwidth',"145");
		el.dom.setAttribute('title','');
	});
	Ext.QuickTips.init();
	//externalLinks();

});
*/
function onEmailPage (companyname,productname,customername,customermail) {
	mailtoform=new Ext.form.FormPanel({
		errorReader: new Ext.form.XmlErrorReader(),
		border:false,
		frame:false,
		bodyStyle:'padding:5px 0 0 5px;',
		autoHeight:true,
		autoWidth:true,
		labelWidth:80,
		waitMsgTarget: true,
		items:[{
			name: 'pageurl',
			xtype:'hidden',
			value:location.href
		},{
			msgTarget:'under',
			name: 'target_mail',
			width:200,
			xtype:'textfield',
			fieldLabel:"Friend's email",
			emptyText:"Type your friend's email here.",
			value:""
		},{
			msgTarget:'under',
			name:"subject",
			width:200,
			xtype:'textfield',
			fieldLabel:'Subject',
			emptyText:"Type the message subject here.",
			value:companyname+' - '+productname
		},{
			msgTarget:'under',
			name:"sender_name",
			width:200,
			xtype:'textfield',
			fieldLabel:'Your name',
			emptyText:"Type your name here.",
			value:customername
		},{
			msgTarget:'under',
			name:"sender_mail",
			width:200,
			tabIndex:0,
			xtype:'textfield',
			fieldLabel:'Your email',
			emptyText:"Type your email here.",
			value:customermail
		}/*,{
			html:'<img src="http://91.139.255.233/xcarttest/antibot_image.php?section=email_page" height="41" width="110" />',
			height:40,
			border:false
		}*/],
		buttons:[{
			        text: 'Send Email',
			        disabled:false,
					handler:function () {
						mailtoform.getForm().submit({
							url:'/include/email_this_page.php',
					        method:'POST',
							success:function(){mailtowindow.close();},
							failure:function(){Ext.Msg.show({text:'asd'});Ext.Msg.hide();},//IE bug...
				        	waitMsg:'Please wait...'
						});
					}
		}]
	});
	mailtowindow=new Ext.Window({
		modal:true,
		title:'Email this page to a friend',
		resizable:false,
//		height:175,
		autoheight:true,
		width:312,
		items:[mailtoform]
	});
	mailtowindow.show();
}
function emailthispage(form) {
	alert(form);
	x=form;

}
Ext.form.XmlErrorReader = function(){
    Ext.form.XmlErrorReader.superclass.constructor.call(this, {
            record : 'field',
            success: '@success'
        },
		['id', 'msg']
	);
};
Ext.extend(Ext.form.XmlErrorReader, Ext.data.XmlReader);
